详解CSS的结构与层叠以及格式化

2020-05-03 11:30:53易采站长站整理

    This is text<em>some of which emphasized</em>,plus other text<br>which id <strong style ="font-size:24px;verical-align:4px">strongly emphasized</strong>and which is<br>larger than the surrounding text.   
</p>  

把元素上升4像素,折回同时提升其内容区和行内框。由于strong元素的行内框顶端已经是行中的最高点,对垂直对其的这个修改会把整个行框的顶端也向上移4像素。效果如图:
201621120157658.png (412×66)

垂直对齐影响行框高度。

如果line-height不使用单位,而是用值小于1的数值,那么line-height将会相对于元素本省font-size设置行高,而不是相对于父元素设置。