0

I need to select all body elements except two ids and apply css rules to them. I am using this code and it works for one id, but when second one is added the code does not work anymore. This code works:

body>*:not(#frm){
filter: blur(3px);
pointer-events: none;
}

I have tried this, but it does not work:

body>*:not(#frm,#dte2){
  filter: blur(3px);
  pointer-events: none;
}

and this

body>*:not(#frm),(#dte){
  filter: blur(3px);
  pointer-events: none;
}

So my question is how do you select 2 ids?

Ricky97
  • 79
  • 8

1 Answers1

4

The problem with selecting two IDs for a :not() negation is that #frm would match the criteria for not being #dte, and #dte would match the criteria for not being #frm.

What you need to do is chain two :not() pseudo-selectors together as body>*:not(#frm):not(#dte):

body>*:not(#frm):not(#dte) {
  filter: blur(3px);
  pointer-events: none;
}
<body>
  <div id="frm">Frm</div>
  <div id="dte">Dte</div>
  <div id="other">Other</div>
</body>
Obsidian Age
  • 41,205
  • 10
  • 48
  • 71