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


Devan Tormey
Devan Tormey
627 Points

How do I prevent weird spacing in gallery images?

In my responsive.css file I am trying to correct for a weird error in spacing. In the tutorial in the How to Make a Website track we learned to use the nth-child technique to fix a similar issue, however, this appears to not work for me... When in the mobile layout the six image in my two column layout is causing the image above to be pushed over thus ruining the two column set-up. Here is my code to resolve it, but it doesn't seem to do anything:

gallery li {

width: 28.3333%; }

gallery li:nth-child(6n) {

clear: left;


1 Answer

8,131 Points

I had the same problem. It displayed incorrectly using Firefox, but fine when using Internet Explorer. I actually made a small change to the padding in the portfolio class to correct the problem.