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

Nathan Nielsen
Nathan Nielsen
5,215 Points

I can't get the background color to change. What did I do wrong?

<html> <head> <meta charset="utf-8"> <title>Nate Nielsen | Treehouse Student</title> <link rel="stylesheet" href="css/normalize.css"> <link href='https://fonts.googleapis.com/css?family=Changa+One|Open+Sans:400,400italic,700,700italic,800' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/main.css"> <link rel="stlyesheet" href="css/responsive.css"> </head> <body> <header> <a href="index.html" id=logo> <h1>Nate Nielsen</h1> <h2>Treehouse Student</h2>

@media screen and (min-width: 480px) { body { background-color: navy; } }

The top code is from my index.html and the @media is in my responsive.css

Nathan Nielsen
Nathan Nielsen
5,215 Points

I'm not sure if I'm using snapshot right, but if I did. Here is my code.

https://w.trhou.se/nmjy0ity2o

6 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Nathan,

You didn't do anything wrong, and I have no explanation as to why this fixes it...

If you 'cut' the code from the reponsive.css and paste it at the bottom of your main.css and save everything and refresh the page... everything works fine.

And, then if you 'cut' it from main.css and paste it back into you responsive.css and save everything... it all still works. I don't know why, but it works. Lol.

Keep coding! :)

Kurtis Towery
Kurtis Towery
1,436 Points

I know this is old but I just had this issue and what caused it for me was 480 pixels was to low of a number. My browser window just won't go that narrow.

Nathan Nielsen
Nathan Nielsen
5,215 Points

Thank you so much! Workspace shutdown a couple times while I had it up. Maybe that caused it. Either way thank you.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

You're Welcome! :)

Got to love those whaaa? glitches. Lol.

Nathan Nielsen
Nathan Nielsen
5,215 Points

That was the problem Allison. Good eye!

Lili Köves
Lili Köves
3,471 Points

Same problem. Tried what Jason Anders wrote down, but after pasting it back to responsive.css the background goes back to white. No clue what to do.

This is my code from responsive css:

@media screen and (min-width: 480px) { body { background: navy; } }

And from index.html:

<head> <meta charset="utf-8"> <title>Lili Koves | Designer</title> <link rel="stylesheet" href="css/normalize.css"> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,700italic,800,800italic,300italic,300' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="responsive.css"> </head>

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

It looks like the link for your responsive CSS stylesheet is incorrect. It's missing the css/ prefix. Should be ->

<link rel="stylesheet" href="css/responsive.css">

Hope that helps. :) :dizzy: