0

What is nth-child

9th Sep 2019, 11:44 AM
Javohir
Javohir - avatar
2 Answers
+ 10
Nth-child is simply used to apply styling to a specific child of a parent element. For example, HTML : <div class="parent"> <div class="child"></div> <div class="child"></div> </div> CSS : . parent :nth-child(2) { color: blue; } Doing that will style the second div which is a child of the .parent div https://www.w3schools.com/cssref/sel_nth-child.asp
9th Sep 2019, 11:58 AM
Oma
Oma - avatar