jacquesramphal / jacquesramphal.github.io

Jacques' personal site and playground
http://ramphal.design
1 stars 0 forks source link

units rem em #30

Closed jacquesramphal closed 1 year ago

jacquesramphal commented 3 years ago

While em is relative to the font-size of its direct or nearest parent, rem is only relative to the html (root) font-size.

jacquesramphal commented 3 years ago

https://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use-em-vs-rem--cms-23984

jacquesramphal commented 3 years 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.