The `:focus-within` Pseudo Class

Avatar of Chris Coyier
Chris Coyier on

DigitalOcean provides cloud products for every stage of your journey. Get started with $200 in free credit!

Nice find by Ian Devlin:

The :focus-within pseudo class becomes active when an element itself has focus or if any of its descendants does.

Selecting a parent element based on children is lonnng awaited. The crown jewel of that is :has(). I wonder if that’s getting closer.

Direct Link →