我不明白为什么 span 元素的高度大于它的字体大小(边距和填充 = 0):JSFiddle example
<head>
<style>
.analized-element {
font-size: 20px;
font-family: "Lucida Console", "Lucida Grande", monospace;
}
</style>
</head>
<body>
<span class="analized-element">Test message</span>
</body>
此问题仅在 Mac 中存在:
== analized-element =====
border-size: 0 0 0 0
padding: 0 0 0 0
font-size: 20px
offsetHeight: 23px
=========================
我们如何看到有 3 个额外的像素。 Windows 中的相同示例:
== analized-element =====
border-size: 0 0 0 0
padding: 0 0 0 0
font-size: 20px
offsetHeight: 20px
=========================
span 的高度等于它的字体大小。
最佳答案
@media screen and (max-device-width: 460px){
body{
-webkit-text-size-adjust: none;
}
}
关于html - 为什么 SPAN 的高度大于它的字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34357256/