:nth-of-type(n) only counts child elements of a certain type specified in the parent element "n" is its parameter, and can be an integer value (1,2,3,4), It can also be expressions (2n+1, -n+5) and keywords (odd, even), but the starting value of parameter n is always 1, not 0. In other words, when the value of parameter n is 0, the selector will not select any matching elements.
:nth-of-type(n) only counts child elements of a certain type specified in the parent element
"n" is its parameter, and can be an integer value (1,2,3,4), It can also be expressions (2n+1, -n+5) and keywords (odd, even), but the starting value of parameter n is always 1, not 0. In other words, when the value of parameter n is 0, the selector will not select any matching elements.
This brother explained it very well, so I won’t move it and look at the difference between CSS3 selectors:nth-child and :nth-of-type for myself
It’s best to check MDN for this kind of problem
https://developer.mozilla.org/zh-CN/docs/Web/CSS/:nth-of-type
CSS selectors:nth-child(n) and:nth-last-of-type(number)