vibskov
vibskov

Reputation: 275

How to select all div in `.content` but not contain the div I don't want to?

How to select all div in .content but not contain the div I don't want to?

.content div:not(class="a", class="c"){ // not work
    display: none;
}

<div class="content"></div>
    <div class="a"></div>
    <div class="b"></div>
    <div class="c"></div>
    ...
</div>

Upvotes: 3

Views: 81

Answers (1)

Cat
Cat

Reputation: 67502

Chain them together, and use .a or .c for classes a and c:

.content div:not(.a):not(.c){
    display: none;
}

Working jsFiddle

Upvotes: 4

Related Questions