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

CSS CSS Basics (2014) Enhancing the Design With CSS Media Query Basics

what am i doing wrong here? media query not responding

/* Media Queries ------------------ */

@media all (max-width: 960px) { body { background: royalblue; }

p { color: white; }

}

@media all (max-width: 480px) { body { background: darkred; } }

1 Answer

Bryan Peters
Bryan Peters
11,996 Points

Take out "all" and it works fine. Media type "all" is implied if you don't specify another value.

alternatively use "and" like this:

@media all and (max-width: 480px)

unfortunately that didnt work either

/* Media Queries ------------------ */

@media (max-width: 960px) { body { background: royalblue; }

}

@media (max-width: 480px) { body { background: darkred; } }

@media (min-width: 481px) and (max-width: 700px) { body { background: seagreen; } p { color: white; } }

Bryan Peters
Bryan Peters
11,996 Points

Check syntax for any css above your media queries. If you have any syntax errors, the rest of the css doesn't process. The code you posted works fine for me. If you are still having issues, post the full css.

spot on with the syntax check! the float clearfix didnt have a closing bracket on it! i feel such a fool! thanks for that bud!