The closest thing we have to a CSS parent selector

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

IntermediateUI9 min

About this video

A walkthrough of the CSS :focus-within selector, explaining how it can style a parent element when a child receives focus and where it falls short compared with a true parent selector. It suits developers who already write CSS.

What you’ll learn

  • Style a parent element based on focus inside its children using :focus-within
  • Identify the cases where :focus-within does not replace a true parent selector