Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何选择所有 div.content但不包含我不想要的 div?
.content
.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>
将它们链接在一起,并将.aor.c用于类a和c:
.a
.c
a
c
.content div:not(.a):not(.c){ display: none; }
工作的jsFiddle