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 Responsive Web Design and Testing Adding Breakpoints for Devices

Jason Gaspero
Jason Gaspero
2,372 Points

Adding Breakpoints Code Challenge doesn't seem to be working right

For the first "code challenge" question, it asks, "Create a breakpoint for devices 480 pixels wide or larger. Inside the breakpoint, set the h1 font-size to 2.5em.

So I enter the following code:

@media screen and (min-width: 480px) { h1 { font-size: 2.5em } }

However, when I do this, I get the answer, "Bummer! Did you change the h1 font-size to 2.5em for devices larger than 480px?

I could be wrong here, but isn't this exactly what I did in the above code?

Why is this wrong?

2 Answers

Hi Jason,

You could get that result if you placed your media query at the top. It should be at the bottom so that the existing css doesn't have a chance to override it.

Technically you don't need a semi-colon to end the last or only declaration in a rule but I recommend always including one.

Thank you! I couldn't get past this either. Since we used the separate file I didn't realize it would need to be at the end.

I get the first breakpoint code to work for the 480px:

@media screen and (min-width: 480px) { h1 { font-size: 2.5em; }

But when I use the same code with the min-width set to 660px and the font-size set to 1.75em I get, "Bummer! Did you change the h2 font-size to 1.75em for devices larger then 660px?" What am I missing?

Did you close off your 480px media query? It looks like you're missing a closing curly brace.

I also had the same question, but glad to see that it's been cleared up! Thanks!