Selectors

CSS :has() Selector Playground

:has() is the CSS parent selector. Style an element based on what it contains or what follows it, without walking the DOM in JavaScript.

Challenge 1 of 5 0 correct
Live DOM
HTML

0
out of 5
Widely availableSince 202394% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2023.

Safe to use without fallbacks.

105+
121+
15.4+
105+
ESC