3 ms·
The em unit is relative to the inherited font size. If you don’t specify an absolute font size or inherit one then you inherit the user agent default for the <b
by jahewson 6y ago
The em unit is relative to the inherited font size. If you don’t specify an absolute font size or inherit one then you inherit the user agent default for the <body> which is 16px.
- giancarlostoro 6y agoIt gets worse, I had to follow up[0] on what you've said, but if the parent element is also using EM the size keeps increasing. Namely according to the MDN docs I read: > To recap, the em unit means "my parent element's font-size" in the case of typography. The <li> elements inside the <ul> with a class of ems take their sizing from their parent. So each successive level of nesting gets progressively larger, as each has its font size set to 1.3em — 1.3 times its parent's font size. So REM is what you probably want if you intend to do some nesting and use the parents root font-size, set it once, apply it everywhere. TIL what em really does, versus what rem does. [0]: https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_...