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

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,860 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: