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

Design Prototyping in the Browser Design Patterns Image Carousels

tyler borg
tyler borg
9,429 Points

nth-child(2) ???

what is he doing with this nth-child(2) and nth-child(3)? Do you always have to use this for carousel images?

1 Answer

Chidiebere Ekennia
Chidiebere Ekennia
5,950 Points

No, you do not. nth-child(n) - where "n" can be any number or a mathematical equation, is just another css selector. For example, using nth-child(2) would mean you want to select the 2nd child of an html element. Using "div nth-child(2)" would mean the 2nd child element of this div element. In summary, you do not have to use it for carousel images. Any css selector like a class or id could easily replace it.