我不明白为什么 span 元素的高度比其字体大小更高(边距和填充=0):JSFiddle示例
<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
=========================
的高度等于其字体大小。
offsetHeight: 20px
。你用的是什么浏览器? - jcaron