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

Akhter Rasool
Akhter Rasool
8,597 Points

Doubts regarding Ems in CSS

body{ font-size: 2em; } /* h1 is inside body/* h1{ font-size: 4em; }

in the above code, the font size of body is (16px * 2em = 32px)32px, so will the font-size of the h1 rule be(4em*32px = 132px) 132 px ??? since its 4em times the parent's font-size.??

Please Explain/

1 Answer

Tobias Helmrich
Tobias Helmrich
31,602 Points

Hey Akther,

there is not much to explain because you understood it perfectly! :) However note that 4em * 32px = 128px and not 132px. But for the rest you're right. In this case the h1's font-size would be 4 times the font-size of the body which would be 128px as the body's font-size is 32px.

I hope that helps! :)