微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何测量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

原文地址:https://www.jb51.cc/css/217658.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。