StealThis .dev

Animated Gradient Text

Text with animated gradient colors flowing through it using background-clip text and CSS keyframe animation.

Open in Lab
css javascript vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Animated Gradient Text

Text with a flowing animated gradient effect using background-clip: text and CSS @keyframes. The gradient smoothly shifts through multiple colors creating an eye-catching heading effect.

How it works

  1. A large background-size: 200% auto gradient is applied to the text element
  2. background-clip: text and color: transparent make the gradient visible only through the text glyphs
  3. A @keyframes animation shifts background-position from 0% to 200% creating the flowing motion

Customization

  • Change gradient colors via the CSS custom property --gradient-colors
  • Adjust animation speed with --gradient-speed (default 3s)
  • Works with any font size and weight

When to use it

  • Hero headings and landing page titles
  • Highlighted keywords or brand names
  • Call-to-action text that needs extra visual pop