我有一个div
要使用 nth-child 选择器设置样式的 s 列表。我还希望能够排除 adiv
如果它有某个类,即:
<style>
.a:not(.b):nth-child(2n) {
color: hotpink;
}
</style>
<div class="a"> Test </div>
<div class="a b"> Test </div>
<div class="a"> I should be pink, as i am the 2nd child that doesnt have a "b" class </div>
<div class="a"> Test </div>
<div class="a"> Test </div>
<div class="a"> Test </div>
<div class="a"> Test </div>
<div class="a"> Test </div>
<div class="a"> Test </div>