Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Basics (2014) Understanding Values and Units Em Units

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

em

Is em unit responsive?

Benjamin Kuijs
Benjamin Kuijs
17,022 Points

Hi Aakash Srivastav,

An em unit is not fully responsive. It is related to its default pixel size of the body; mostly 16px; Unless you define a different value to it.

Take a look at these two links, it may help you a little:

https://www.w3schools.com/tags/ref_pxtoemconversion.asp

https://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use-em-vs-rem--cms-23984

Kind regards, Benjamin

Patrik Horváth
Patrik Horváth
11,110 Points

answere is nop

use "rem" and always define root to 10px :) so 1 rem = 10px

1 Answer

dragos busuioc
dragos busuioc
24,908 Points

em is a responsive unit.Is responsive to the parent.For example if you set font-size 2em to a paragraph which is inside a div with font-size 16px,the paragraph font-size in px is 32 px.I suggest to use rem.Is relative to root element(html, or body)