December 2017

CSS sudo selector focus-within

Ever wanna style a parent when a child element receives focus?

A common problem, how do you style a parent when a child gets focus? Usually around form inputs, often with a label element I encounter this.

The sudo selector :focus-within allows you to do this. Still a long way off from a child being able to style it's parent, but in the case of forms, this is often what you want.


➜ Read more on MDN