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 Layout Techniques Positioning Schemes Relative Positioning

Media quiery

Many Time I saw the error on media queries and it doesn't work which I follow the video with the code

@media (min-width: 769px) {

.main-wrapper {
    width: 95%;
    margin: auto;
}

I just wondering since there would be red highlight on "min-width" and the "{" behind 769px. I don't know what wrong but before on "How to make the website lesson" I have some experience on media queries and before I did this

@media screen and (min-width: ... ) and it work.

What is the right way to do media queries see my code here

http://teamtreehouse.com/workspaces/347502#

3 Answers

Adam Moore
Adam Moore
21,956 Points

The media query would work with what you have, assuming you ended with a "}" to close off the media query. However, the code challenges may say that there is an error in your code if you aren't following the directions for the challenge. For instance, if you don't put the words "screen and" as part of the media query when the instructions say to do so, then it'll say that your code has an error. Sometimes it's pretty particular about what it will accept as a correct answer, but most of the time the instructions are very clear as to what they are looking for. So, as long as you follow the instructions closely, you should be fine.

Thanks for your answer. Thus about "screen and" if I put this in the code what would affect to the output?

Adam Moore
Adam Moore
21,956 Points

It wouldn't affect anything if you are using it on a screen, like we are here. However, if you are desiring to set up settings for when the user wants to print something, then the word "print" would be used instead of "screen".