When it comes to create a responsive website to fit the every device, It is important to know the right CSS units. But before diving into decision ...
For further actions, you may consider blocking this person and/or reporting abuse
em
is the parent font size only if it appears in thefont-size
property, otherwise it's the elements own font-sizevw
isn't the width of the browser window, but the viewport. That is, window borders are not included*.vh
* For whatever reason, scroll bars are included though, which I find mildly infuriating.
my bad, but again I have already mentioned that what the vw stands for.
Très bonne explication. Car, certains utilisent les unités dans le désordre.
Surtout les développeurs-youtubeurs
merci à vous deux.
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 ???
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 afont-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 of1.8em
and youra.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.You can also set a max-width in characters instead of pixels, ems, etc. which is pretty sweet:
e.g. p{max-width:80ch;}
Amazing 👏👏
The most useful css units explanation. Nothing is so easy to understand! Great infographic but it will be better if improved like just a little bit specific and in pdf. Thank you!
Sure, will improve if got the time.