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

Yannick Bisaillon
Yannick Bisaillon
1,348 Points

h1 context ~ responsive design

What is the context of an h1? How do I convert my 20px h1 to ems

  • h1 { font-size: 20px; }

Using 16px as my context don't work.

  • h1 { font-size: 1.25em; } - 20px / 16px = 1.25em

My 20px h1 don't look the same as my 1.25em h1.

Sry for my english ~ Thanks

At the start of your css body font-size is set to 16px.

Yannick Bisaillon
Yannick Bisaillon
1,348 Points

I don't have any font-size set to 16px :/

2 Answers

Mike Bronner
Mike Bronner
16,395 Points

I think what Adam meant was this:

body
{
font-size: 16px;
}

h1
{
font-size: 1.5em; /* change the "1.5" to whatever size you need */
}

This is what I meant. Yannick you need to set the base font size for the document for the em value to have something to take as the context.

Yannick Bisaillon
Yannick Bisaillon
1,348 Points

Oh, okay! Thanks for you'r time! I'll try this out