最佳答案
假设我有一个定义为 inline-block 的 span
元素。它的内容只是纯文本。当字体大小非常大时,您可以清楚地看到浏览器如何在文本的上方和下方添加一些填充。
HTML:
CSS:
span {
display: inline-block;
font-size: 50px;
background-color: green;
}
<span>BIG TEXT</span>
Looking at the box model, it's clear the browser is adding padding inside the content edge. I need to remove this "padding", one way is to simply alter the line-height, as with:
This works great in Chrome but in Firefox the text is shifting towards the top (FF17, Chrome 23, Mac OSX).
Any idea of a cross-browser solution? Thanks!