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

Write a media query at 705px where the layout begins to break, that forces grid_1 through grid_6 to span 100% width of the container.

What am I doing wrong?

@media screen and (max-width:705px){ .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, { width: 100%; } }

Thanks, B. Banks

22 Answers

@Brandon -

You have a comma after the last list item, you need to remove it. In CSS just as in English, you don't need a comma after the last item in a list.

I had to move mine to the bottom of the page to make it work.

@ J. Barnett,

Thanks for the lightening response.

@Brandon - You're quite welcome. Let us know here in this thread if you have any more questions about media queries.

how am i still wrong here?

@media screen and (max-width: 705px) { .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 {width: 100%} }

syntax is really throwing me off with these challenges lol. Just that one little thing breaks the code. Ill get it eventually.

I struggled with this one too. Your code looks right. make sure there are no semi colons at the end of "px" or "%" make sure things are indented correctly too.

yeah i have the exact same code as you and it won't work and I cannot seem to find out why

Robby White
Robby White
11,369 Points

I have this and can't get it to work as well:

@media screen and (max-width: 705px) { .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 { width: 100%; }

I changed the location of mine to the bottom of the page and then it worked

This worked for me. They need to label where they want the code so the test work and you don't go craze when the code is right just not where they want it

get rid of this at the top of the page .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 and then insert this code at the very bottom of the page and walla!! @media screen and (max-width: 705px) { .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 { width: 100%; } }

none of the above work for me, what should i do?

Micha Kaufman , compare your code to mine. It should look like this:

@media screen and (max-width: 705px) { .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 { width: 100%; } }

Most people usually mess up the media query identifier. I am pretty sure that is where your mistake is. Good Luck!

my code was literally identical to yours but wouldn't pass, I pasted in yours and it passed, I checked very carefully and there were no syntax errors in mine

same problem I copy and paste the CSS and still I must recheck my work where is the exact location?

@media screen and (max-width:705px){ .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 { width: 100%; } }

I am having the same problem and cannot figure it out? I get the error: "Bummer! Be sure to set the media query at 705px."

Ok, got it. I removed to much of the code in the middle of the body...

still got the problem of where in the code I should put this.

I have tried all advice given but still no change

This is the error I get Did you set the width for grid_1 through grid_6 to 100%?

I have checked the text over and over I have copied and pasted the correct answer into every line of the code and still nothing

Lets address the Giant Elephant in the room there is a second sheet called style.css but it is well nearly impossible to see. put this code;-

@media screen and (max-width: 705px) { .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 { width: 100% } }

right at the bottom.

It would seem everyone has assumed that everyone knew this and not bothered to mention it.

You're right on the money. Thanks for the help.

everything is easy if you know how to do it. You can watch the same video 100 times and not get the one piece of information you need.

In the "Implementing Media Queries" video (https://teamtreehouse.com/library/websites/build-a-responsive-website/adaptive-design/implementing-media-queries) at 1:44 Allison Grayce says: "... head to the very bottom of the stylesheet, where we should always write our media queries"

That said make sure that you write your @media screen and (max-width: 705px) { } query at the bottom of the CSS file.

Exactly so. You need to write the following code at the bottom of the style.css sheet:

@media screen and (max-width: 705px) { .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 { width: 100% } }

Don't forget your semicolons to end each property! It signifies the end of a line to the computer/server. it should look like this:

 ```css
@media screen and (max-width: 705px) {
     .grid_1,
     .grid_2,
     .grid_3,
     .grid_4,
     .grid_5,
     .grid_6 {
              width: 100%;
         }
 }

You don't have to do nothing but put the code as it should be:

@media screen and (max-width: 705px) { .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 { width: 100%; } }

I tried several things but nothing worked and I noticed that there is an underline showing error under max-width property. Refreshed the page and the same code worked.