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

4th item on a column of 3 elements not clearing left in CSS

Hi there guys,

I have racked my brain on this for ages. The forth row with this code is not clearing left. It is often messy depending on the screen size. I have added a clearfix. Still not happening. Here is the code:

#portfolio-gallery li {
      width: 28.333333%;
      margin: 2.5%
  }

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

Any tips?

I have also tried

#portfolio-gallery li {
      width: 28.333333%;
      margin: 2.5%
  }

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

I am stumped.

Hope to hear from you guys soon! :)

2 Answers

Dale. You are legend!

Solved! I have been trying to work that out for days!

That made my night.

Thanks heaps mate!