What is 'em' in CSS? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

What is 'em' in CSS?

I know pixels, percents, but when we need to use 'em'?

11th Apr 2018, 1:34 AM
Rull Deef 🐺
Rull Deef 🐺 - avatar
3 Answers
+ 11
It is a relative unit of measurement. The size of an em is determined in relation to the size of the font used (it is said that specifically based on the size of the letter M). By default this size is 16 pixels (the size that default browsers assign to typographies). https://www.w3schools.com/cssref/css_units.asp https://www.w3.org/Style/Examples/007/units.en.html
11th Apr 2018, 1:42 AM
Mickel
Mickel - avatar
+ 5
Mickel, thanks ^^
11th Apr 2018, 2:07 AM
Rull Deef 🐺
Rull Deef 🐺 - avatar
+ 5
These 4 units come very handy, when doing responsive designing em - relative to its parent rem - same as em but relative to root i.e. html vw - viewport width ( in % of overall screen width) vh - viewport height ( in % of overall screen height)
24th Jul 2018, 4:25 PM
Morpheus
Morpheus - avatar