This question is basically an extension of this one about an issue I was having with vertical centering. Finding the answer to that question created a need for this question.
Have a look at this JSFiddle. It sets up a container to be 60px tall.
.container {
background-color: lightgreen;
height: 60px;
max-height: 60px;
line-height: 60px;
font-size: 60px;
}
In Firefox, it is 60px
tall in all cases. In Chrome, the text height is actually taller than 60px
(sometimes 69px
, sometimes other values).
I can reduce the font-size
to 52px
to get it to line up as exactly 60px
tall in Chrome (thus giving me a perfectly 60px
tall inline element and allowing me to vertically center reliably) but that is specific not only to Chrome, but to the computer.
How can I get a consistent font height?