Skip to content
Back to Concepts
CSS UniverseCurriculum:is(), :where(), and :has()
Modern CSS 2026 StandardsCore Concept 04

:is(), :where(), and :has()

The modern holy grail of CSS. Style a parent container based on what's inside it with :has(), and tame specificity once and for all with :is() and zero-weight :where().

1. The Holy Grail: :has()

The Relational "Parent" Selector

For 25 years, CSS could only look downward in the DOM tree (styling children). :has() allows an element to style itself conditionally based on its children or sibling elements!

Standard Text Card

No avatar present. Card renders in compact layout.

CSS in action:
.card:has(.avatar) {
border-color: #10b981;
background: rgba(16, 185, 129, 0.1);
}
2. Specificity Transformers

`:is()` vs `:where()`

Both pseudo-classes let you group multiple selectors cleanly without repeating rules. But they handle specificity completely differently:

:is(a, b, c)Highest Specificity

:is() adopts the specificity of its most specific argument!

:is(header, #main-nav, footer) a {
color: blue;
}
Specificity: (0, 1, 0, 1) — Because #main-nav is an ID!
:where(a, b, c)ZERO Specificity (0, 0, 0, 0)

:where() contributes ZERO specificity! The arguments are completely ignored in scoring.

:where(header, #main-nav, footer) a {
color: blue;
}
Specificity: (0, 0, 0, 1) — Just the 'a' tag! Even the ID counts as 0!
Why does :where() matter? Component libraries and design systems use :where() to provide default base styles that developers can effortlessly override with a single normal class without having to fight specificity wars!
Next Concept in Curriculum

5. Cascade Layers (@layer)

Explicit architecture ordering that triumphs over selector specificity.

Continue to Cascade Layers