Use : not () e.g.
li:nth-child(2n):not(.skip_class){
}
li:nth-child(2n):not(.skip_class){
background:green;
}
<ul>
<li>test</li>
<li class="skip_class">test</li>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
</ul>
Run codeHide resultUpdate
, , "skip_class", , "skip_class"
sibling +,
li:nth-child(2n):not(.skip_class), .skip_class + :not(.skip_class)
li:nth-child(2n):not(.skip_class),
.skip_class +:not(.skip_class) {
background: green;
}
<ul>
<li>test</li>
<li class="skip_class">test</li>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
</ul>
Hide resultUdpate
, (), , , nth-child nth-of-type .
(:not(.skip_class)), (nth-child)
. : nth-child() : nth-of-type() ?