1

I need something like this:

html.select_everything :not(#ignore-me):not(#ignore-me *)

The above doesn't work because I can't use both the #ignore-me and the * in the same :not. Is there a plain css solution for this?

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
Rokit
  • 977
  • 13
  • 23

2 Answers2

1

Not really.

An approach that will reliably work is to override the style:

.select_everything, .select_everything * {
   color:red; border:solid 1px silver;padding:2px;
}

.select_everything #ignore-me, .select_everything #ignore-me * {
  color:black;border:none;
}
<div class="select_everything">
  top level <div>under top level</div>
  <div id="ignore-me">not this <div>or this</div></div>
</div>

What you're trying to do is not supported. MDN - :not() says using , in :not in only supported in Safari:

The ability to list more than one selector is experimental and not yet widely supported.

Further, :not is not meant for nested selectors like a *, see nesting inside css :not() selectors

Kobi
  • 135,331
  • 41
  • 252
  • 292
0

Hope this might help you

 .select_everything :not(#ignore-me,#ignore-me *) {
           //your css here
        }
Sushil
  • 1,111
  • 1
  • 10
  • 23