CKTIS / CSS
:where() — matching without adding specificity
The :where() pseudo-class matches elements against a selector list, but contributes zero specificity, including its arguments. It helps create easy-to-override base styles.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
:where(<forgiving-selector-list>):where() matches an element satisfying any selector in its list. Unlike :is(), its specificity is always (0,0,0), even when an argument contains an ID.
Selectors outside the parentheses still count: .card :where(p, #intro) has specificity (0,1,0). Invalid list entries are ignored; an empty list matches nothing. Pseudo-elements are not allowed in the arguments.
Zero specificity does not bypass the cascade: origin, importance, and other earlier criteria still matter. In the example, .notice beats the later :where(#message, .notice) rule because both declarations have the same earlier priorities and .notice has higher specificity.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>:where() specificity</title>
<style>
.notice { color: rgb(0, 128, 0); }
:where(#message, .notice) { color: rgb(255, 0, 0); }
</style>
<p id="message" class="notice">Status</p>
</html>Result
getComputedStyle(document.getElementById('message')).color === 'rgb(0, 128, 0)'The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.