Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

brandon downs
brandon downs
11,577 Points

i think i have the correct code written, but it keeps telling me i am wrong

keeps telling me to make sure to set clear:left; and i have. but each time i check my work it tells me that i have not set clear:left;

for the list items in the div with id = gallery in the media query at the bottom of the css

what am i doing wrong?

css/main.css
@media screen and (min-width: 480px) {
  #gallery li {
    width: 28.3333%;
  }

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

2 Answers

It's every 4th child so it should be like this

@media screen and (min-width: 480px) {
  #gallery li {
    width: 28.3333%;
  }

  #gallery li:nth-child(4n) {
    clear: left;
  }
}
brandon downs
brandon downs
11,577 Points

thanks, cant believe i missed that!

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,624 Points

Hi Brandon,

You didn't link to the challenge you are trying to complete, so this is just kind of a guess. But, if I remember correctly, for this particular challenge, I think you are missing the 'n' in the parameters for the nth-child(). Try (4n).

When asking questions from a challenge, it's best if you click the "Get Help" button directly in the challenge, follow the prompts, and make sure "Attach My Code to this post" is checked. This will just make it much easier for others to make sure they are giving the correct advice. :)

Hope that helps. :) If not, provide at least a link to the challenge in a Comment here.

:dizzy: