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 trialTristan Johnson
Courses Plus Student 3,022 PointsWhere did #gallery li:nth-child(4n) come from?
It wasn't addressed in any previous videos. What does it even do?
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Tristan,
It was addressed in the previous video at around the 8:15 mark - https://teamtreehouse.com/library/how-to-make-a-website/responsive-web-design-and-testing/build-a-three-column-layout
After setting the width to 28.3333%, Nick shows what the problem is with the captions and how nth-child fixes the problem.
Also, be sure to check out the teacher's notes for that video because it contains an important correction for the nth-child expression and an explanation. It should be 3n + 1
and not 4n
Sean T. Unwin
28,690 Points#gallery li:nth-child(4n)
means to select the fourth list item in #gallery
.
You can learn about nth-child() from the CSS Selectors course.