:where()
W3C CSS Snapshot 2026
Match any option in its selector list without adding specificity for the arguments.
On this page
Syntax and values
| Value or syntax | What it does |
|---|---|
:where(p, .notice) | Matches paragraphs and elements with class notice. This function has zero specificity. |
Try the example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>:where()</title>
<style>
.notice { color: teal; }
:where(p, .notice) { color: purple; }
</style>
</head>
<body>
<p class="notice">Registration opens Monday.</p>
<p id="location">Meet in Room 2.</p>
<h2>Workshop</h2>
</body>
</html>
What to expect The notice stays teal because its class rule has higher specificity. The other paragraph is purple.