:where
Widely availableSince 202197% of users
Like :is() but with zero specificity. Lets you style without affecting selector specificity.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since January 2021. Widely available since July 2023.
The old way and the modern waySee the snippet: Low-specificity resets without complicated selectors →
Old way 5 lines
.prose ul, .prose ol {
margin: 0;
padding-left: 1.5rem;
}
/* Specificity (0,1,1). Component .list { padding: 0 } loses. */Modern 5 lines
:where(.prose ul, .prose ol) {
margin: 0;
padding-inline-start: 1.5rem;
}
/* Specificity 0. .list { padding: 0 } wins. */See how modern your own CSS is.Check your CSS →
Quick example
h1:where(.card, .panel, .modal) { margin-top: 0; }Examples
Style links with zero specificity
:where(a, button) {
color: blue;
}
a.custom { color: red; } /* This overrides :where() easily */Unlike :is(), :where() has zero specificity, so other CSS rules can override it without using !important.
Simplify complex selectors without boosting specificity
.container :where(.card, .panel, .modal) {
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}:where() is perfect when you want to group selectors but need to keep specificity low for cascade flexibility.
Create overrideable component styles
:where(.button) {
padding: 8px 16px;
}
.button.large { padding: 12px 24px; } /* Easy to override */Use :where() for base component styles so specific classes can override them without specificity wars.
Common pitfalls
- :where() has zero specificityWhile this is useful for overrideable styles, it also means even a simple .class selector can override :where() rules. Be aware that any other selector will beat it.
- Not the same as :is():where() and :is() work the same way, but :where() always has zero specificity while :is() takes the highest specificity of its arguments. Choose based on your cascade needs.
:where browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2021.Safe to use without fallbacks.
Usage97%of people can use this3% use a browser without it.
Browsers
88+
78+
14+
88+Mobile
88+Android
79+Android
14+iOS