What is the difference between em and rem units?

Both em and rem units are based on the font-size CSS property. The only difference is where they inherit their values from.

  • em units inherit their value from the font-size of the parent element
  • rem units inherit their value from the font-size of the root element (html)

In most browsers, the font-size of the root element is set to 16px by default.

Extra Info

  • Benefits of using em and rem units
Additional links

Leave a Reply

Your email address will not be published. Required fields are marked *

*