li:nth-child(1) { animation:txt1 2s ease-in-out infinite; } | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 8

li:nth-child(1) { animation:txt1 2s ease-in-out infinite; }

what is the work of nth-child in this code ?? I saw this sector in code play ground

15th Mar 2017, 4:51 PM
Prashanth Kumar
Prashanth Kumar - avatar
6 Réponses
+ 6
I didn't understand
15th Mar 2017, 4:54 PM
Prashanth Kumar
Prashanth Kumar - avatar
+ 6
thx
15th Mar 2017, 4:57 PM
Prashanth Kumar
Prashanth Kumar - avatar
+ 2
eg: ul li:nth-child(2){ color:#f00; } mean that only second li will be red
15th Mar 2017, 4:57 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
+ 1
first li element in ul get animation
15th Mar 2017, 4:54 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
+ 1
nth-child is a selector similar as first-child or last-child. nth-child is a selector that let you choose a child inside a HTML tag, if you have 10 child inside a tag and you don't want to get the first one or the last one. nth-child is the correct choice, you can say that you want the 3rd child that way nth-child(3).
15th Mar 2017, 5:00 PM
Geoffrey L
Geoffrey L - avatar
0
np
15th Mar 2017, 4:58 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar