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

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!