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!