:has() Parent Selector Playground

Motif cards on Mrs. Lastri’s frame: your :has() selector becomes a real rule, each match is numbered with the child or sibling that made it match, and ticking…

Why it matters

:has() replaces the most common JS pattern: "if a child is ticked, invalid or present, restyle its parent". Fewer classList.toggle calls, and the visual state follows the real DOM. Every modern browser supports it.

The key idea

:has() picks the element it tests, not its content

Common mistakes

Try it in this playground