Learn Backend Development Part-Time, Online
Learn Generative AI, Prompt Engineering, and LLMs for Free
Overview
Google, IBM & Meta Certificates – 40% Off
One Coursera Plus subscription covers most Professional Certificates on Coursera.
Unlock All Certificates
This short tutorial builds a direction-aware hover effect for a navigation menu using modern CSS. It covers an animated underline, CSS custom properties, and a fallback for browsers that do not support :has().
Syllabus
- Introduction
- What we are starting with
- Using padding instead of gap
- Adding the underline with a pseudo-element
- Adding a basic animation on hover
- Making the line move to the right
- Making the line move to the left
- Cleaning things up with custom properties
- Improving the animation so that it slides
- Browser support for browsers that don’t support :has
- This isn’t perfect!
Taught by
Kevin Powell