1/* Selects the second <li> element in a list */
2li:nth-child(2) {
3 color: lime;
4}
5
6/* Selects every fourth element
7 among any group of siblings */
8:nth-child(4n) {
9 color: lime;
10}
11
1/* Select the first list item */
2li:nth-child(1) { }
3
4/* Select the 5th list item */
5li:nth-child(5) { }
6
7/* Select every other list item starting with first */
8li:nth-child(odd) { }
9
10/* Select every 3rd list item starting with first */
11li:nth-child(3n) { }
12
13/* Select every 3rd list item starting with 2nd */
14li:nth-child(3n - 1) { }
15
16/* Select every 3rd child item, as long as it has class "el" */
17.el:nth-child(3) { }
1/* Select the first list item */
2li:nth-child(1) { }
3/* Select odd list items */
4li:nth-child(odd) { }
5/* Select even list items */
6li:nth-child(even) { }
7/* Select each list item every 3 (3,6,9...) */
8li:nth-child(3n) { }
9/* Select each list item every 3 starting from the fourth (4,7,10...) */
10li:nth-child(3n+1) { }