3 ms·
Using em and ex is definitely the best way of doing relative font sizing, but the reason is something I don't think people properly understand. 1em is the widt
by geoffmunn 6y ago
Using em and ex is definitely the best way of doing relative font sizing, but the reason is something I don't think people properly understand.
1em is the width of a capital M character. 1ex is the height of the capital X character (of the font currently in use).
If you specify block element dimensions using em and ex values, then the margins and paddings will be relative to the font and it will look really nice (in my opinion).
- maskros 6y ago1em as used in fonts and browsers has nothing to do with the size of a capital M character (though the name as used historically means it should). A font is drawn using a design size box (typically 1000x1000 units in OTF, 2048x2048 in TTF) and this box is scaled to the 'em' size. How big the glyphs inside the design box are drawn varies from font to font (which is the problem that the article is talking about). The ex unit is supposed to be the height of the _lower case_ X character (not the upper case) -- but typically is just 1ex = 0.5em