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

HTML How to Make a Website Responsive Web Design and Testing Refactor the Layout

Nicholas Cipponeri
Nicholas Cipponeri
2,987 Points

how do i set clear left on every fourth gallery list item

What is wrong with my code?

@media screen and (min-width: 480px) {

  #gallery li{
    width: 28.3333%;
  }

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

3 Answers

Hi Nicholas,

You have a space after the colon : in your nth-child selector which is invalid syntax.

Remove that space and you should pass.

#gallery li:nth-child(4n) {
Nicholas Cipponeri
Nicholas Cipponeri
2,987 Points

Hi Jason,

I went back and you are right, there was an extra space after the colon. Thank you!

Gregor Weindl
Gregor Weindl
3,271 Points

set the nth-child to (4n + 4) which means start with the 4th and then every 4th.

Brandon Burton
Brandon Burton
9,688 Points

You've got an extra pair of braces there. Everything else is correct.

It should read:

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

Still learning to use Markdown. My apologies for the bad formatting but I hope this helps!