These selectors include first-child, last-child, only-child, nth-child(n), nth-last-child(n) and first-of-type, last-of-type, only-of-type, nth-of-type(n), nth-last-of-type(n). Of all the selectors, these ten are probably the most misunderstood.
1. Regarding n
1) The expression of n is: xn y. Such as 1, 2n, 2n 1.
2) n in the nth-child(n) series numbers all child elements of the parent element; n in nth-type-child(n) only numbers elements of the same type, ignoring the middle ones Incorporated other elements.
2. E:first-child and E:first-child
The above two ways of writing are different. There is a big difference between whether there is a space before :first-child and whether there is a space. This is also the most misunderstood part.
1) E:first-child without spaces means "select such an E element, which is the first child element of its parent element";
2) E with spaces :first-child means "select the first child element of the E element".