Closed jacquesramphal closed 1 year ago
Important to Know:
It’s a somewhat widespread misconception that em units are relative to the font size of the parent element. In fact, as per the W3 spec, they are relative to the font size “of the element on which they are used”.
Parent element font sizes can effect em values, but when that happens it’s solely because of inheritance. Let’s take a look at why, and see how this works in action.
While em is relative to the font-size of its direct or nearest parent, rem is only relative to the html (root) font-size.