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

General Discussion

Need help with Media Queries

I put <link rel="stylesheet" href="css/responsive.css"> underneath my all my main.css and then my code for responsive.css was:

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

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

Is there any reason as to why this wouldn't work?

I don't know why it cut off what I said, but essentially I put my new code for responsive.css underneath my main.css for all categories.

6 Answers

Hi, it's because you need to use background-color.

Thanks for your response. Unfortunately, my background remains white. Everything up until this point has worked flawlessly, but now I'm afraid I made a minor mistake in the beginning that maybe is causing this problem.

I've just tried your code and it's working. Maybe is the order of the CSS Stylesheets are added...

That's what I'm thinking. I'll go back and check. Thanks again for the help.

Hello Jonathan,

First let's check the obvious. Make sure that you have saved all of your documents with there most recent edits and refresh your browser once you have done so. Then try playing around with the size of your browser to see if you are able to get the desired outcome.

Next make sure that your files are organized correctly. Your "responsive.css" document should be located in a folder titled "css" along with your "main.css" document.

Your "index.html", "about.html", and "contact.html" files should all be in the directory "above" your css folder.

Lastly check to make sure that you have correctly linked the "responsive.css" stylesheet to each of your html documents. It should look something like this:

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

This line should be below the link for your "main.css" file in each html document.

Hope this helps.

It was a browser issue. Apparently I needed to clear my cookies and cache. Thank you both for taking the time to help.

Glad you figured it out! Happy coding.