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.


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.