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

Edwin Goddard
Edwin Goddard
8,988 Points

Is the nth-child right

should it not be 3n+1 so that it's the first one on every row of 3?

4n will be 4, 8, 12

we want 4, 7, 10

Hi Edwin,

This is also a problem for the 2 column layout.

You can find more info about this problem in this post: https://teamtreehouse.com/forum/3-column-layout-nth-clear-not-working

3 Answers

Cherie Burgett
Cherie Burgett
8,711 Points

In the teachers notes under this video

"A more robust solution is to use the selector :nth-child(3n + 1) instead. This will select every 3rd item plus 1. In other words, this will select the 4th item, 7th item, 10th item, and so on.

Edwin Goddard
Edwin Goddard
8,988 Points

Thanks for that. I hadn't even noticed.

Thomas Gallagher
Thomas Gallagher
3,900 Points

Actually, (3n+1) will select the 1st, 4th, 7th item and so on.

n starts at 0 so 3n+1 is equivalent to 3(0)+1, 3(1)+1, and so on. If you want to select every third element starting at the fourth element the proper expression would be (3n+4).

Hi Thomas,

Yes, that's correct. The notes don't specify that the first item would be selected too.

It doesn't hurt to clear the first item although it isn't strictly necessary. I would recommend doing it for the sake of consistency.