Quick guide to CSS focus states

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

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

IntermediateUI7 min

About this video

Kevin Powell explains the differences between the CSS pseudo-classes :focus, :focus-within and :focus-visible and what each one lets you style. It is aimed at developers and designers who already write CSS.

What you’ll learn

  • Style an element when it or a child receives focus with :focus-within
  • Apply focus styles only for keyboard users with :focus-visible
  • Tell apart :focus, :focus-within and :focus-visible in a form and menu