Skip to content

Animated Gradient Text

Pure CSS animated gradient text for headings using background-clip, with four palettes, a shine sweep variant, a CSS-only pause switch and a fallback color.

Also known as: gradient text animation, animated heading gradient, colorful text effect, shimmer text

Animated Gradient Text live demo

Open in new tab

Pure CSS code (HTML, CSS)

Animated gradient text in pure CSS, with no JavaScript at all. A colorful gradient flows through the letters of a heading, with palette presets, a light-sweep "shine" variant and a CSS-only pause switch. Use it for hero headlines, product names, section titles and launch pages.

How it works

The root section.gt-showcase contains a .gt-hero with the main headline and a .gt-grid of three .gt-card examples. The effect lives on a single class: any element with .gt-text gets background-image: var(--gt-gradient), a background twice as wide as the text, and background-clip: text with a transparent text fill, so the gradient is only visible through the letters. The gt-flow keyframes move background-position from 0% to 200%, which shifts the repeating gradient by exactly one tile. Because each palette starts and ends with the same color, the loop has no visible jump.

Palette modifiers such as .gt-text--aurora, .gt-text--sunset, .gt-text--ocean and .gt-text--candy only set --gt-gradient and a solid --gt-fallback color. .gt-text--shine adds a white highlight layer on top of the gradient and animates both layers with the gt-shine keyframes. .gt-text--slow doubles the duration. The pause switch is a visually hidden checkbox; the rule .gt-showcase:has(.gt-toggle-input:checked) sets animation-play-state: paused on every gradient text inside the section.

All gradient rules sit inside @supports for background-clip: text, so older browsers show the readable fallback color instead of invisible text.

Customization

  • --gt-speed on .gt-showcase: the duration of one loop, e.g. 3s for faster movement.
  • --gt-angle: the gradient direction; try 135deg for a diagonal flow.
  • --gt-gradient in a palette modifier: define your own brand colors, and repeat the first color at the end for a seamless loop.
  • --gt-fallback: the solid color used where background-clip: text is unsupported.
  • Add .gt-text--shine to any .gt-text element for the light sweep, or .gt-text--slow for a calmer pace.
  • --gt-bg and --gt-card: the page background and card color of the showcase.
  • Remove .gt-toggle if you do not need the pause switch.

Use cases

  • Hero headlines: a colorful gradient flows through the letters of the main title
  • Product names: palette presets such as aurora, sunset, ocean and candy suit different brands
  • Launch pages: a shine sweep variant adds a light highlight across a key word
  • Section titles: visitors can pause the motion with a CSS-only switch

Accessibility

The text stays real text: it is selectable, searchable and read normally by screen readers. The gradients are chosen to stay bright on the dark navy background. The pause switch is a native checkbox inside a label, so it works with the keyboard and shows a focus outline on .gt-toggle-track. With prefers-reduced-motion: reduce the animation stops and a static gradient remains.

Usage notes

Use .gt-text on inline-block or block elements; the hero uses display: inline-block with a little bottom padding so descenders are not clipped. The :has() pause rule needs a current browser.

Animated Gradient Text at a glance

Framework
Pure CSS
Code
HTML, CSS
JavaScript
Not needed, CSS only
Dependencies
None
Layout
Responsive, works on mobile, dark design
Category
Text Effects
License
Free for personal and commercial use

Questions about this template

Can I use the Animated Gradient Text code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

There is nothing to install. Paste the HTML where the component should appear and add the CSS to your stylesheet. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. It is built with HTML and CSS only, so there is no JavaScript to load.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

No dependencies. Pure HTML, CSS and JavaScript.

Animated Gradient Text – free Pure CSS text effect template
Animated Gradient Text · free Pure CSS text effect template

More Text Effects

Glitch Text Effect – free Pure CSS text effect template

Glitch Text Effect

Pure CSS glitch heading with sliced cyan and magenta copies, CRT scanlines, and subtle, hover-only and acid palette variants.

Typing Text Effect – free Pure CSS text effect template

Typing Text Effect

Pure CSS typewriter effect with a blinking caret, using steps() and ch units on a monospace headline and a retro terminal window with replay.

Image Clipped Text with Photo Fill – free Pure CSS text effect template

Image Clipped Text with Photo Fill

Large pure CSS heading filled with a slowly panning mountain photo through background-clip text, with a solid color fallback.