Create direction-aware effects using modern CSS

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

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

IntermediateUI19 min

About this video

A step-by-step CSS tutorial that builds a direction-aware hover underline for a navigation menu, using padding, pseudo-elements, custom properties and :has(). It also covers browser support fallbacks for the effect.

What you’ll learn

  • Build a sliding underline hover effect with a pseudo-element
  • Make a hover indicator move in the direction the pointer enters
  • Use custom properties to tidy up animated navigation styles