What is the use of nth-child() selector in CSS?

Back to Questions

It is used to inherit the properties of the parent element.


If nth-child() is given for an element, it will automatically take some pre-defined styles.


It is used for zebra-striped tables.


It is used to give proper spacing between the parent element and child element.


It is generally used to display different background-colors for even and odd rows in tables.


Author Explanation :

For zebra-striped tables, use the nth-child() selector and add a background-color to all even (or odd) table rows.

© Copyright 1997 - 2019 | www.bestdotnettraining.com | www.deccansoft.com | All Rights Reserved.
Bestdotnet google plus
Enquiry Now