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

what am I doing wrong if I want to clear every 4th list item in the element with the if of "gallery"?

gallery li:nth-child(4){

    clear: left;
}

4 Answers

Brian Jensen
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Brian Jensen
Treehouse Staff

From what I can tell you are missing the id declaration # before gallery, and the n (counter) after the 4. The code below should fix it.

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

Thank you Brian. It is exactly what I had and it is not working:/

Brian Jensen
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Brian Jensen
Treehouse Staff

From what you pasted it shows:

#gallery li:nth-child(4) { /* No **n** after the 4 */
    clear: left;
}

The code I pasted:

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

Did you add the n later and still not working?

Oh you are right. Thanks! :)