CSSMar 19, 2026 · Updated Oct 13, 2026 · 2 min read

How to Create a CSS Text Gradient (Color Text Effect)

Gradient text with background-clip, current browser support from MDN's data, and the contrast check most tutorials skip: the classic coral-to-lavender demo gradient scores under 3:1 on white.

✨
Try the CSS Text Gradient
Free, no signup
→
DG
Derek Giordano
Designer & Developer
In this guide
01The Technique02Contrast Is Checked Per Color, Not Per Gradient03High-Contrast Modes04Animated Gradients05Building One

The Technique

.gradient-text { color: #A18CD1; }         /* solid fallback */
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .gradient-text {
    background: linear-gradient(135deg, #FF6B6B, #A18CD1);
    -webkit-background-clip: text;           /* Chromium before 120 */
    background-clip: text;
    color: transparent;
  }
}

The gradient is painted as the element's background, background-clip: text trims it to the glyph shapes, and a transparent text color lets it show through. MDN's compatibility data lists unprefixed background-clip: text in Chrome and Edge 120, Safari 14 and Firefox 49, so the -webkit- line only matters for older Chromium. color: transparent works as well as -webkit-text-fill-color; both produced identical pixels in our test.

Contrast Is Checked Per Color, Not Per Gradient

Every part of the text has to be readable, so each gradient color must pass on the background behind it. For the usual demo gradient:

StopOn whiteOn #0B0D17 (dark)
#FF6B6B2.77:16.98:1
#A18CD12.92:16.63:1

On white both stops fail even the 3:1 that WCAG 2.2 allows for large text (24px, or 18.66px bold); on a dark background both pass 4.5:1. Pastel gradients on light pages are the common failure. Pick stops that each pass, which on white usually means darker, more saturated colors.

High-Contrast Modes

A frequent worry is that transparent text vanishes in Windows high-contrast mode. We rendered the heading in Chromium with forced-colors: active emulated: the browser replaced the transparent color with the system text color and the heading kept the same amount of ink (6,755 vs 6,446 dark pixels in our screenshot test). To control the result instead of relying on the override, add:

@media (forced-colors: active) {
  .gradient-text { background: none; color: CanvasText; }
}

Animated Gradients

Sliding background-position across a 200%-wide gradient creates a shimmer. It repaints the text every frame, so keep it to one short headline, stop it after a few cycles or on hover, and wrap it in @media (prefers-reduced-motion: no-preference).

Building One

The CSS Text Gradient previews linear, radial and conic gradient text with your own words and copies the CSS. Check each stop in the Contrast Checker against your real background before shipping.

Frequently Asked Questions

How do I make gradient text in CSS?+
Use background: linear-gradient(...), -webkit-background-clip: text, and -webkit-text-fill-color: transparent. The gradient is applied as a background and then clipped to the text shape.
Does CSS gradient text work in all browsers?+
Yes. The -webkit-background-clip: text property works in Chrome, Firefox, Safari, and Edge. The -webkit- prefix is still required for Safari.
Can I animate CSS gradient text?+
Yes. Set background-size: 200% auto and animate background-position. This creates a shimmering effect. Always wrap in a prefers-reduced-motion check for accessibility.
Try it yourself

Use the CSS Text Gradient — free, no signup required.

⚡ Open CSS Text Gradient
DG
Derek Giordano
Written by the creator of Ultimate Design Tools. BA in Business Marketing.