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 trialRyan Cross
5,742 Pointsem values;
I see how they work but I'm not seeing the advantage over a px value. Why not skip the calculation?
1 Answer
Steven Parker
231,248 PointsThe advantage of em units is the dimensions you set will adapt to the font size. With pixels it will never change.
c s
1,866 Pointsc s
1,866 Pointsaccording to the video there is no absolute value so how does the em and rem value relative to ,steven ?
Steven Parker
231,248 PointsSteven Parker
231,248 PointsIf I understand your question, rem values are relative to the default font size of the document, and em values are relative to the font size of the parent element.
c s
1,866 Pointsc s
1,866 Pointsoh got that , tks u , at first i see no default value , so i don't know which base do rem and em lean on cause every font-size are rem and em
Steven Parker
231,248 PointsSteven Parker
231,248 PointsIf not explicitly set in the CSS,
1rem
will be equal to the default font-size provided by the browser (usually 16px).