Solid-colored text does the job. Gradient text grabs attention. The technique has become a staple of modern web design, showing up in hero headlines, product names, and brand marks across the web. Apple, Stripe, Linear, and many startups use it to make their headings pop.
The CSS is short. Three properties on a text element create the effect. The hard part is making the gradient look intentional instead of gimmicky, which takes a few design rules.
This guide covers the CSS, the design rules, animation techniques, and the accessibility traps to avoid.
The Core CSS Technique
Gradient text in CSS uses three properties together:
`css
.gradient-text {
background: linear-gradient(90deg, #3b82f6, #8b5cf6);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
}
`
How it works:
1. background sets a gradient as the element's background
2. background-clip: text clips the background to the shape of the text
3. color: transparent (or -webkit-text-fill-color: transparent) makes the text itself invisible, revealing the gradient behind it
The -webkit- prefix is still needed for Safari and some mobile browsers in 2026. Always include both the prefixed and unprefixed versions.
Gradient directions:
- 90deg or to right: horizontal, left to right
- 180deg or to bottom: vertical, top to bottom
- 135deg or to bottom right: diagonal
- 45deg: the other diagonal
Design your gradient colors with the Gradient Generator. Test multiple color combinations before deciding. What looks good on a color picker often looks different when applied to text at different sizes.
Pick precise start and end colors with the Color Picker to ensure the gradient works well against your background color.

Design Principles for Gradient Text
Gradient text is easy to implement badly. These principles keep it looking professional.
Use on headings, not body text: gradient text is for accent and emphasis. Applying it to paragraphs makes them harder to read and dilutes the visual impact. Limit gradient text to h1/h2 headings, brand names, and short callout phrases.
Choose analogous colors: gradients between similar hues (blue to purple, orange to red, green to teal) look natural. Gradients between complementary colors (red to green, blue to orange) often look muddy in the middle where they mix.
Contrast with the background: a blue-to-purple gradient on a white background looks vibrant. The same gradient on a medium gray background can feel washed out. Dark backgrounds generally make gradient text more vivid.
Match the brand palette: random gradients feel decorative. Gradients that use your brand colors feel intentional. Apple's gradients use colors from their product line. Stripe uses its signature blue and purple.
Less is more: one gradient text element per section is impactful. Three gradient headings on the same page is visual noise. Use gradient text for the single most important headline, not everything.
Font weight matters: gradient text works best on bold, heavy fonts. Thin fonts do not carry enough color area for the gradient to read clearly. Use font-weight 600 or higher for gradient text.
Size matters: small gradient text (under 18px) looks blurry and is hard to read. The gradient effect needs enough physical space to display the color transition. Use gradient text at 24px or larger.
Gradient text is easy to implement badly.
Advanced Gradient Techniques
Beyond basic linear gradients, several techniques create more sophisticated effects.
Multi-stop gradients:
`css
.gradient-text {
background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
}
`
Radial gradient text:
`css
.gradient-text {
background: radial-gradient(circle at 30% 50%, #3b82f6, #8b5cf6);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
}
`
Conic gradient text:
`css
.gradient-text {
background: conic-gradient(from 180deg, #3b82f6, #8b5cf6, #ec4899, #3b82f6);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
}
`
Animated gradient text:
`css
.gradient-text {
background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899, #3b82f6);
background-size: 300% 100%;
background-clip: text;
-webkit-background-clip: text;
color: transparent;
animation: gradient-shift 4s ease infinite;
}
@keyframes gradient-shift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
`
The animation shifts the gradient position, creating a flowing color effect. Use sparingly because it draws attention away from other content.
Minify your gradient CSS for production with the CSS Minifier. Gradient declarations can be verbose, and minification removes unnecessary whitespace without changing the visual output.
Accessibility and Fallbacks
Gradient text creates accessibility challenges that you must address.
Contrast requirements: WCAG requires a minimum 4.5:1 contrast ratio for normal text and 3:1 for large text. With gradient text, the contrast varies across the text. Some parts may meet the ratio while others do not. Test the lowest-contrast point of the gradient against the background.
Color blindness: gradients that rely on hue differences (blue to red) may be invisible to people with color vision deficiency. Ensure the gradient also has sufficient luminosity contrast (light to dark) in addition to hue changes.
Forced colors mode: Windows High Contrast mode and other forced color modes override background-clip. Users in these modes see regular text with the forced color scheme, which is the correct behavior. Gradient text degrades gracefully.
Fallback for older browsers:
`css
.gradient-text {
color: #3b82f6; / fallback solid color /
background: linear-gradient(90deg, #3b82f6, #8b5cf6);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
`
Browsers that do not support background-clip: text will ignore the gradient and display the solid fallback color.
Print stylesheets: gradient text often does not print correctly. Add a print media query that removes the gradient:
`css
@media print {
.gradient-text {
background: none;
-webkit-text-fill-color: currentColor;
color: #000;
}
}
`
Selection styling: when users select gradient text, the selection background may clash with the gradient. Add a custom selection style:
`css
.gradient-text::selection {
-webkit-text-fill-color: white;
background: #3b82f6;
}
`

Common Mistakes and Fixes
Gradient not showing: the most common issue is forgetting color: transparent or -webkit-text-fill-color: transparent. Without it, the text color covers the gradient. Always include both the standard and webkit-prefixed versions.
Text appears as a solid block: this happens when background-clip: text is not applied. The background fills the entire element instead of clipping to the text shape. Check that both the standard and prefixed properties are present.
Gradient looks different on iOS: Safari on iOS sometimes renders gradient text with slight color differences. Test on actual iOS devices, not just browser emulators.
Copy-paste produces invisible text: when users copy gradient text, some browsers paste it as white or transparent text (carrying the transparent color property). This is a known limitation. The text data is there, but the formatting may be invisible in the paste destination.
Gradient breaks on line wrap: long gradient text that wraps to multiple lines may restart the gradient on each line (depending on the browser). Use background-size and display: inline or display: inline-block to control how the gradient flows across lines.
Gradient text with text-shadow: text-shadow works on the transparent text, not on the gradient. If you add a shadow, it appears as a colored shadow matching the text color (transparent). To add a shadow effect to gradient text, use filter: drop-shadow() on a wrapper element instead.
FAQ
Does gradient text affect SEO?
No. Search engines read the text content regardless of CSS styling. Gradient text is a visual treatment only. The underlying HTML text is indexed normally.
Can I use gradient text in emails?
Email client support for background-clip: text is very limited. Gmail, Outlook, and Yahoo Mail do not support it. For emails, use an image of gradient text or stick with solid colors.
Is animated gradient text distracting for users?
It can be. Continuous animation draws the eye, which is useful for one key element but disruptive when applied broadly. Respect the prefers-reduced-motion media query to disable animations for users who have requested reduced motion.
How do I make gradient text responsive?
The gradient scales naturally with the text size, so it works at any viewport width. Use responsive font sizes (clamp(), vw units, or media queries) and the gradient adapts automatically. No gradient-specific responsive adjustments are needed.
### Does gradient text affect SEO.
CSS Layout Tools: Grid, Flexbox, Gradients and Shadows
A practical guide to CSS Grid, Flexbox, gradients, and box shadows. Learn when to use each layout technique and generate clean CSS code fast.
Edit Images in Your Browser: Resize, Compress, Convert
Handle common image tasks in your browser without installing software. Resize, compress, convert formats, and inspect EXIF metadata in seconds.
CSS Generators: Gradients, Flexbox, Grid and Shadows
Use CSS generators to create gradients, flexbox layouts, grid systems, and box shadows. Visual editors output ready-to-copy CSS for your project.
