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 How to Make a Website Responsive Web Design and Testing Refactor the Layout

Media Query difficulties

The code challenge is asking me to select the gallery and remove the fourth column. I really think I have the code correct but it keeps rejecting it. Here is my code:

#gallery li:nth-child (4n) { clear: left; }

any help would be much appreciated! thanks!

3 Answers

Hi Kyle,

Remove the n from (4n) and remove the space between child and (4n).

Jeff

#gallery li:nth-child(4) {
  clear: left;
}

Thanks Jeff! fixed my problem

It's every 4th list item.

Should be 4n.

4 will select the 4th item only.

This challenge passes with many incorrect answers and the staff is working on it last I heard.

With clear:left you're removing the float from the element. Maybe you mean "display:none;"

"Inside the media query, clear the left side of every 4th list item in the gallery."

That is specifically what the code challenge is asking me to do. I should have initially typed out the whole question haha.

Marty Hitchcock
Marty Hitchcock
13,108 Points

Been awhile since I have done that but have you tried replacing "li" with either "ul" or "ol"? I read that code as selecting the children of an element, and the list items are the children you want to be selecting rather than the parent.