DEV Community

Cover image for em VS rem

em VS rem

Abdulqudus Abubakre on May 23, 2020

In the world of CSS and sizing, there are several units that can be used either for your font sizing, margin, padding and so on. Two commonly us...
Collapse
 
rahuldkjain profile image
Rahul Jain

Amazing explanation indeed!

Collapse
 
ibn_abubakre profile image
Abdulqudus Abubakre

Thanks

Collapse
 
bayuangora profile image
Bayu Angora • Edited

So, where's rem inherited to if we don't fill anything (margin, padding, font-size, etc) on html class?

Collapse
 
danielatwood profile image
Daniel Atwood

I think most browsers default the body to 16px which is what rem would be set to.

Collapse
 
ibn_abubakre profile image
Abdulqudus Abubakre

Yes, it has a default of 16px

Collapse
 
timothyokooboh profile image
timothyokooboh

One of the "clearest" explanations I have seen on this topic.

Collapse
 
ibn_abubakre profile image
Abdulqudus Abubakre

Glad I could help

Collapse
 
yusufsaif profile image
yusuf-saif

What a very nice and interesting write up
Hope we will be expecting more right