Elevating text link microinteractions: Sliding underlines, gradient fills, and hover cues
A plain blue underline is functional, but modern editorial layouts demand thoughtful micro-delight. Exploring sliding underlines that track pointer direction and gradient fills turns basic inline anchors into expressive navigational moments.
How to Use the Link & Underline Effects (3 Simple Steps)
Select Link Animation Style
Choose from Underline Sweep (left-to-right), Center Expand, Background Highlight, Glowing Stroke, or Magnetic Slide.
Fine-Tune Timing & Thickness
Adjust underline thickness, offset distance from text baseline, hover duration, and accent colors.
Copy CSS Snippet
Copy clean, accessible CSS classes ready to apply to your navigation menus, blog body text, or footer links.
Features & CSS Best Practices
Modern text-decoration-thickness
Uses modern standard CSS text-decoration-thickness and text-underline-offset properties for clean baseline typography.
Expanding Pseudo-Element Sweeps
Styles smooth sliding underlines using transform: scaleX() for buttery 60fps hardware-accelerated animations.
Editorial Highlight Backdrops
Simulates yellow highlighter or gradient marker pen sweeps beneath important text strings.
Accessible Contrast Ratios
Maintains WCAG 2.1 compliance between link text, underline strokes, and background surfaces.
Frequently Asked Questions
Why is text-underline-offset better than border-bottom for links?
The native text-underline-offset property aligns with typographic baselines, gracefully skips letter descenders (like g, y, p) via text-decoration-skip-ink, and renders cleanly across wrapped multi-line text.
How do I create an underline that grows from left to right on hover?
Use an ::after pseudo-element with transform: scaleX(0); transform-origin: left;, and on :hover set transform: scaleX(1);.
Can link hover animations work across multi-line paragraphs?
Yes! Using background-image with background-size transitions allows underlines to wrap across multiple lines of text seamlessly.
How do I remove the default blue underline in CSS?
Set text-decoration: none; on the anchor element, then apply your custom styling.
How do I style external links to open in a new tab safely?
When using target="_blank" on external links, always add rel="noopener noreferrer" to prevent security vulnerabilities (tabnabbing) and protect performance.
How do I create an animated underline link effect that expands on hover?
Set an absolute ::after pseudo-element with height: 2px, width: 0%, and left: 0; bottom: 0;. On a:hover::after, transition width: 100% across 0.25s ease for an elegant left-to-right expansion.
What is the modern CSS way to style external links with an icon?
Use the attribute selector a[href^="http"]:not([href*="yourdomain.com"])::after to automatically append an external link arrow icon or SVG mask to all outbound URLs across your website.
How do I style link underlines with text-underline-offset and text-decoration-thickness?
Modern CSS provides text-underline-offset: 4px; to increase breathing room between text descenders and lines, and text-decoration-thickness: 1.5px; for refined typographical control.
How do I remove the default link underline and only show it on hover?
Declare text-decoration: none; on the base anchor selector, and add text-decoration: underline; inside the a:hover and a:focus-visible state rules.