CSS :not() with Multiple Classes

The :not() pseudo-class in CSS allows you to select elements that do not match a specified selector. To use it with multiple classes, you can pass a list of selectors as the argument to the :not() pseudo-class.

Here’s an example of how you can use the :not() pseudo-class with multiple classes:

button:not(.btn-danger, .btn-primary) {
background-color: gray;

This selector will select all button elements that do not have either the btn-danger or btn-primary classes and set their background color to gray.

It’s worth noting that the :not() pseudo-class is supported in all modern browsers and is a widely adopted CSS feature.

Another way You can achieve that is like this –