How to vertically center inline elements in CSS
This may seem like a silly question, but I am not getting the expected results from vertical-align
. So…
Does
vertical-align:center
center the child items of the item that has this property, or does it center the item itself that has this property, within its parent?To me, “开发者_高级运维center” means the distances between the item’s top margin and the container’s top padding, and the item’s bottom margin and the container’s bottom padding are the same. This doesn’t seem to always be the case. Is the “bottom” of an inline element the baseline of the text?
Thanks!
Please take a look here: http://www.w3schools.com/css/pr_pos_vertical-align.asp
According to that, vertical-align:middle make the item itself in middle according to the parent.
精彩评论