:has() opens up new possibilities with CSS

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

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

IntermediateWeb DesignUI15 min

About this video

A tutorial on the CSS :has() pseudo-class, covering how it works as a parent selector and how it can select elements based on their siblings. It shows several practical examples for people who already write CSS.

What you’ll learn

  • Select parent elements based on their children with :has()
  • Style an element based on a specific sibling using :has()
  • Apply :has() as a preceding sibling selector