What Is a CSS Text Gradient?
CSS text gradients apply color transitions directly to text characters — no image editing needed. The technique uses background-clip: text to mask a gradient background to the shape of the text, creating eye-catching headings and display type that would otherwise require Photoshop or Illustrator.
The CSS Technique
Three properties work together: background: linear-gradient(...) defines the gradient colors and direction. -webkit-background-clip: text clips the gradient to the text shape. -webkit-text-fill-color: transparent makes the original text color invisible so the gradient shows through. This tool generates all three properties with your chosen colors, angle, and font settings.
How to Use This CSS Text Gradient
- Type your text — Enter the heading or text you want to apply a gradient to.
- Choose gradient colors — Pick two or more colors for your text gradient. Bold color combinations work best on headings.
- Set the gradient direction — Adjust the angle — common directions include horizontal (90°), vertical (180°), and diagonal (135°).
- Preview and copy — See the gradient text rendered live, then copy the CSS code needed to achieve the effect.
Tips and Best Practices
- → Use gradient text on headings, not body text. Gradient text reduces readability at small sizes. Reserve it for large, impactful headings and hero titles.
- → The technique uses background-clip. CSS gradient text works by applying a gradient background, then clipping it to the text shape with
-webkit-background-clip: textand-webkit-text-fill-color: transparent. - → Ensure fallback for older browsers. Add a solid text color before the gradient declarations. Browsers that don't support background-clip will show the solid color.
- → Animate gradient text for hero sections. Use CSS animation to shift the background-position for a slowly moving gradient effect on hero headings.
Frequently Asked Questions
\ud83d\udcd6 Learn More
Related Article How to Create CSS Text Gradients \u2192Built by Derek Giordano · Part of Ultimate Design Tools