html5 - 关于css伪类选择器中:nth-of-type(n) 选择器
PHPz
PHPz 2017-04-17 13:19:55
0
4
1076
PHPz
PHPz

学习是最好的投资!

reply all(4)
刘奇

: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)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template