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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Kiwi Dave](https://secure.gravatar.com/avatar/b605c1a399019e8a0fc48eaae309a16b?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Kiwi Dave
5,541 Points4th 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 Severude](https://uploads.teamtreehouse.com/production/profile-photos/2892102/micro_LRG_DSC08584.jpg)
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,349 PointsTry this:
#gallery li:nth-child(3n + 1) {
clear: left;
}
![Dale Severude](https://uploads.teamtreehouse.com/production/profile-photos/2892102/micro_LRG_DSC08584.jpg)
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,349 PointsThis code snippet is from the https://teamtreehouse.com/library/how-to-make-a-website/responsive-web-design-and-testing/responsive-web-design class, if you want to study on it further.
![Jason Anello](https://secure.gravatar.com/avatar/d1304e75238ff7f216f55adc03e08ea1?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jason Anello
Courses Plus Student 94,610 PointsThe teachers notes for this video https://teamtreehouse.com/library/how-to-make-a-website/responsive-web-design-and-testing/build-a-three-column-layout is the one that has the explanation.
Kiwi Dave
5,541 PointsKiwi Dave
5,541 PointsDale. You are legend!
Solved! I have been trying to work that out for days!
That made my night.
Thanks heaps mate!