Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,601 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! :)