19 October 2023

To negate a selector in CSS, you can use the :not() pseudo-class. This allows you to select elements that do not match a specific criteria. It's mostly used with overwrites. This is widely supported, but you can check for more information here: https://caniuse.com/?search=CSS%20%3Anot()

Source code viewer
  1. div:not(.exclude) {
  2. /* Your styles here */
  3. }
Programming Language: CSS