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
Jonathan Martinez
Full Stack JavaScript Techdegree Student 6,439 PointsNeed 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?
6 Answers
Juan Jose Cortes Guzman
7,894 PointsHi, it's because you need to use background-color.
Jonathan Martinez
Full Stack JavaScript Techdegree Student 6,439 PointsThanks 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.
Juan Jose Cortes Guzman
7,894 PointsI've just tried your code and it's working. Maybe is the order of the CSS Stylesheets are added...
Jonathan Martinez
Full Stack JavaScript Techdegree Student 6,439 PointsThat's what I'm thinking. I'll go back and check. Thanks again for the help.
Kyle Baker
6,283 PointsHello 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.
Jonathan Martinez
Full Stack JavaScript Techdegree Student 6,439 PointsIt was a browser issue. Apparently I needed to clear my cookies and cache. Thank you both for taking the time to help.
Kyle Baker
6,283 PointsGlad you figured it out! Happy coding.
Jonathan Martinez
Full Stack JavaScript Techdegree Student 6,439 PointsJonathan Martinez
Full Stack JavaScript Techdegree Student 6,439 PointsI 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.