Legionar Legionar - 2 months ago 6
CSS Question

CSS selector for not having classes

I am using selector to select all elements not having one class:

.list th:not(.foo) {
/* some rules */
}


How I can apply this to more classes?

.list th:not(.foo), .list th:not(.bar) {
/* some rules */
}


The CSS above of course will not do that, I need something like this pseudo:

.list th:not(.foo and .bar)


Is it possible in CSS?

Answer

You can use as many :not() selectors as you like.

:not(.foo):not(.bar)