各類型盒子的基線的確定

各類型盒子的基線的確定
確定盒子的基線的規則
1.1 確定inline-block的基線

The baseline of an ‘inline-block’ is the baseline of its last line box in the normal flow, unless it has either no in-flow line boxes or if its ‘overflow’ property has a computed value other than ‘visible’, in which case the baseline is the bottom margin edge.
1.2 確定replacement的基線

bottom margin edge
1.3 確定inline的基線

就是它所包含的那些文字的基線
1.4 確定inline-table的基線

The baseline of an ‘inline-table’ is the baseline of the first row of the table
1.5 確定block的基線

每個block一般都含有很多行的元素,所以它的基線也有很多條,每條對應一個line-box,line-box的基線確定稍複雜,看第二章
1.6 確定flex-box每行的基線(可能未來需要改)

拿一行中高度最高的Flex-item的第一行文字的基線當做flex-box當前行的基線
1.7 確定line-box的基線(較複雜)

首先不同於其他類型的盒子,CSS 2.1 does not define the position of the line box’s baseline,所以它的基線是不確定的,會隨着行內元素的內容或樣式的改變而改變。具體怎麼改變看第二小節
當一行內有一個elem與line-box同等高度時,因爲元素已經與當前行等高了,所以在這個elem上設置的vertical-align對它本身是沒有視覺上的任何效果的,但會影響當前line-box的基線的位置。
當一行內有多個vertical-align值互不相同的元素時, line-box的基線的位置也會爲了同時滿足這些個所有的vertical-align值而把line-box的基線移動到恰當的位置爲止,常常伴隨浙line-box的高度也會隨之變化

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章