DEV Community

Discussion on: How to decide CSS units for responsive website?

jlopcun profile image

Its an amazing explication , but if the em unit is relative to the font size , and the font size is on em , and 1 em equals 16 px , then , there is no responsive here , we still using a fixed unit because we're using a reference to px ???

darkwiiplayer profile image

The important difference is that em ultimately depends on the user agent configuration, which may take into account the device and user preferences. That is, unlike we set a font-size to an absolute value somewhere, which is a big no in most cases.

Also, many elements change font-size; say your h1 has a font-size of 1.8em and your a.buttom has an outline of .2em, so a button in a heading will get a thicker outline than in the main text, according to the difference in font-size.