1:first-child {
2 //styles here
3}
4
5:nth-child(1) { //the benefit of this is you can do it for 2nd, 3rd etc...
6 //styles here
7}
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) { }