各类型盒子的基线的确定

确定盒子的基线的规则

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的高度也会随之变化

 

 

 

posted @ 2018-02-13 17:15  晚安呢太阳  阅读(538)  评论(0编辑  收藏  举报