'vertical-align'
Value: baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage> | <length> | inherit
Initial: baseline
Applies to: inline-level and 'table-cell' elements
Inherited: no
Percentages: refer to the 'line-height' of the element itself
Media: visual
Computed value: for <percentage> and <length> the absolute length, otherwise as specified
This property affects the vertical positioning inside a line box of the boxes generated by an inline-level element.
vertical-align:設置 由inline-level element(內聯級元素)組成的盒子中豎直方向的對齊位置。
inline-level element有兩種:
- display : inline(內聯元素) ,比如:span。
- display : inline-block (內聯塊元素),可以在一行中排列顯示,並且可以設置width、height,比如img、input。
使用案例:
vertical-align:middle,設置文字和圖片對齊。