如何测量CSS线高?

CSS中的行高是从文本的底部到下一行文本的底部吗?或者文本是否在行内垂直居中?

请看示例图片

解决方法

Form MDN

On block level elements,the line-height CSS property specifies the
minimal height of line Boxes within the element.

On non-replaced inline elements,line-height specifies the height that
is used in the calculation of the line Box height.

正如您在此DEMO和下面的图像中所看到的那样.这意味着对于文本,line-height定义了围绕该框内垂直居中的字母的框的高度,因此您的第一个示例是正确的.

图片来自www.w3.org

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效