CSS: :where selector (is any of)

By Xah Lee. Date: . Last updated: .

Selector :where

:where(s1, s2, etc)

match any of the selectors s1, s2 etc.

s can be simple selector, compound selector or complex selector.

p {
 color: red;
}

/* 0 priority. does not override others */
:where(p) {
 color: blue;
}

Example

:where(h1, h2, h3, h4) {
 border: solid 1px grey;
}

Specificity

:where() has zero specificity.

Difference between :is() vs :where()

Browser support

the selectors :is() and :where() are supported by all major browsers since 2022.