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

Mani Saini
Mani Saini
3,101 Points

1em is equal to 16px?

So if 1em = 16px that means 2em = 32px and 3em = 48em. However in this video when the teacher changed the font size from 3em to 2em, the font became even larger ? I was expecting the fonts to become smaller? Can someone please explain this?

Miroslav Kovac
Miroslav Kovac
11,454 Points

Hello,

Which video do you mean?

1 Answer

I can't really comment on this specific case, as I haven't seen the video, but em sizes are based on the size of the font being used, which isn't always going to be the default size of 16px. Think of em size as a multiplier rather than a fixed number of pixels.

2em = twice as big while .5em = half as big.

If the font is 40px to start with, 2em makes it 80px.