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

HTML How to Make a Website Responsive Web Design and Testing Build a Three Column Layout

Psudo class :nth-child forces my third list item to break to next line.

Hello, Ive been going through the web design course and I have run into the problem where the psudo class :nth-child causes my third image in the gallery on the home page to break to the next line. I tried troubleshooting this but I have not had any success. When I remove

'''css

gallery li:nth-child(3n + 1) {

clear: left;

} '''

from the code, the problem disappears, however I get the problem where the captions push the images out of the way. What can I do about this?

1 Answer

Try this I have finished the track and this is my code:

'''css

gallery li:nth-child(4n) {

clear: left;

} '''

Also make sure you are calling the ID with a hash #

The code you provided was my original code, that did not work either. Also, I am calling the ID with a hash #. I'm not sure what the problem is.