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

Is 1 em always 16 pixels?

The lessons stated to convert pixels to ems in order to have responsive fonts. It stated that ems are always a fraction of the default pixel size. So, is this default size always 16 and do we always divide by 16 to get the right measurements?

3 Answers

Charles Smith
Charles Smith
7,575 Points

No.

From this stackoverflow question, you can see that 1em is not 16px, at least in 2013 when the answer was given.

For this reason, you might want to do as the question suggests - set a body font to 16px, and then your em's will be relative to that. You could also use a "normalize" stylesheet to set a baseline across browsers.

Thanks!

Andre Kucharzyk
Andre Kucharzyk
4,479 Points

That makes no sense whatsoever. Whats the point of using EMS if i set stiff 16px value in body, as a deafult font size. How is it responsive then?