此問題基本上是this one about an issue I was having with vertical centering的擴展。找到這個問題的答案需要解決這個問題。如何在瀏覽器之間獲得一致的行高
看看this JSFiddle。它建立一個60px高的容器。
.container {
background-color: lightgreen;
height: 60px;
max-height: 60px;
line-height: 60px;
font-size: 60px;
}
在Firefox中,在所有情況下都是60px
高。在Chrome中,文本高度實際上高於60px
(有時69px
,有時是其他值)。
我可以減少font-size
到52px
讓它排隊儘可能精確60px
高大的Chrome(從而給了我一個完美60px
高大的內聯元素,讓我和可靠的垂直居中),但是這是具體的不僅是瀏覽器,但對電腦。
如何獲得一致的字體高度?
您是否試圖獲得一致的線高度或字體高度? – Alohci 2014-12-05 01:32:50
線高,我猜。真的,我希望一切都保持一致。 – brentonstrine 2014-12-05 01:51:29
這個以前的問題可能有助於http://stackoverflow.com/questions/10665541/different-line-height-in-firefox-and-chrome-when-using-text-shadow – andyb 2014-12-05 14:38:36