是否有可能使CSS选择器选择最后一个类型并且仅当它是偶数元素时才同时选择?
就像是:
.element:last-of-type:nth-of-type(even) {...}
Run Code Online (Sandbox Code Playgroud)
这是一种选择...
li:last-of-type:nth-of-type(even) {
color: red;
}Run Code Online (Sandbox Code Playgroud)
<ol>
<li>1</li>
<li>2</li>
</ol>
<ol>
<li>1</li>
<li>2</li>
<li>3</li>
</ol>Run Code Online (Sandbox Code Playgroud)