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

HTML How to Make a Website Adding Pages to a Website Add Iconography

when nick sets the font size to .9em, how do you know what is the default size so we can choose less than the default

size. 'em' is relative size to what??

2 Answers

Kevin Kenger
Kevin Kenger
32,834 Points

Hey Nagamani,

The em unit is relative to the font-size of the body. It's called em because it uses the size of the letter M to measure, but all you need to remember is that ems are relative to the font-size that either you or the browser have set for the body.

A few examples:

font-size = 16px, 1em = 16px

font-size = 16px, 2em = 32px

font-size = 20px, 1.5em = 30px

Thanks for your help Kevin, got it, but how do you figure out what the default font-size of the browser is?

Kevin Kenger
Kevin Kenger
32,834 Points

Typically, browsers' default font size is set to 16px. There are exceptions, however, typically in browsers on older handheld devices.

If you'd like to find out what the default font size is, you can use JavaScript, like the option this Stack Overflow post offers (and also frowns upon).

Either way, a good idea would be to use a tool like normalize.css, and of course you can always set the font-size of the body yourself.

ok thanks