1、.class:nth-of-type(n)在选择class的时候,如果在class前面插入x个同类型标签,n需要加上x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 <!DOCTYPEhtml> * {padding: .5em;} .para:nth-of-type(1) {background-color: red;} 我是第1个p.para标签 我是第2个p.para标签 当...
The :nth-of-type pseudo-class takes a single argument, which is an integer. This integer represents the position of the element relative to other elements of the same type. The first element is 1, the second element is 2, and so on....
CSS :nth-of-type() pseudo-class matches elements based on their position among siblings of the same type (tag name).Syntax:nth-of-type( | even | odd) { /* ... */ } Possible Valuesodd − This value represents all odd-numbered (such as, 1,3,5..etc) sibling elements in a ...
css 我怎么能有:not(.class):nth-of-type(even)呢?这个代码片段避免了CSS试图"决定"它是奇数还是...
The :nth-of-type() pseudo-class selects the elements of the same type based on their index. The :nth-of-type() can be specified by a number, a keyword, or a formula. The :nth-of-type selector is similar to :nth-child but there is a difference: it is more specific. The :nth...
CSS global:nth-of-type选择器(:nth-of-class)虽然它使用JavaScript,但您可以在不更改标记的情况下...
CSS global:nth-of-type选择器(:nth-of-class)虽然它使用JavaScript,但您可以在不更改标记的情况下...
Introducing the nth-of-type pseudoclassJen Kramer
如图,如果像选择类名为class="exerciseInfo" 中的第一个和最后一个div,做法如下:选择第一个类名: .exerciseInfo: nth-of-type(1) { ... };选择最后一个类名: .exerciseInfo: last-child { ... };选择其中一个指定的类名:.exerciseInfo: nth-of-type(x) { ... ... ...
如图,如果像选择类名为 class="exerciseInfo" 中的第一个和最后一个div,做法如下: 选择第一个类名: .exerciseInfo: nth-of-type(1) { ... }; 选择最后一个类名: .exerciseInfo: last-child { ... }; 选择其中一个指定的类名:.exerciseInfo: nth-of-type(x) { ... }; ...