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 trialAriel Vainer
7,042 PointsWhat is the correct sintax if I want to use the nth-child in two different lists?
Hi,
If I have 2 ul, how can I target them separately? I want them to have different values. How can I make the difference between both of them?
Thank you!!
2 Answers
Edmon Quiocho
Courses Plus Student 1,408 PointsHi Ariel,
Simply use a "class" for your two ul. Maybe use .listOne and .listTwo then you can target them separately.
Hope this helps.
Ariel Vainer
7,042 PointsThank you!!
Chris Shaw
26,676 PointsHi Ariel,
If you want both lists to see the same CSS when using nth-child
then a class is the best way to go about, just be sure the class comes after your initial CSS for your lists otherwise the styles won't overwrite anything your doing within nth-child
.
Hope that helps.
Ariel Vainer
7,042 PointsThank you!!
Ariel Vainer
7,042 PointsAriel Vainer
7,042 Pointsclass or id before? li:nth-child Or there is a simpler way?