Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
396 views
in Technique[技术] by (71.8m points)

html - When setting CSS font-size in pixels, does the value refer to the width or height of a letter?

Does the pixel value of a font-size refer to the height of the font or the width of the font?

CSS:

.sixteen {
  font-size: 16px;
}

HTML:

<span class='sixteen'>a</span>

Will the "a" be 16 pixels tall or 16 pixels wide, or is that like a max-width/height on both so that the entire character fits in a 16px box?

All the documentation I have seen for this has been ambiguous on the matter.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The height - specifically from the top of the ascenders (e.g., 'h' or 'l' (el)) to the bottom of the descenders (e.g., 'g' or 'y'). See the interesting article on Type Anatomy at http://en.wikipedia.org/wiki/Typeface_anatomy.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...