CSS Text Gradient Generator
Enter your text, pick two or three colours and an angle or radial type, and copy the HTML and CSS for gradient-coloured text.
Enter your text, pick two or three colours and an angle or radial type, and copy the HTML and CSS for gradient-coloured text.
Gradient text is made by painting a gradient as the background of an element and then clipping that background to the shape of the letters with background-clip: text.
Type your text, choose the colours and copy the HTML and CSS. The output has the -webkit- prefixed properties that are still needed in some browsers. There is no preview here, because gradient backgrounds are switched off on this page; paste the code into your own project to see it.
.gradient-text {
background: linear-gradient(90deg, #ff512f, #dd2476);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
It makes the original text colour invisible so the clipped gradient behind it shows through.
Check that every part of the gradient has enough contrast with the page background. Do not use it for long paragraphs.
Yes. For inline elements the gradient is calculated across each line box, so use display: inline-block if you want one gradient for the whole block.
If background-clip: text is not supported the text stays transparent. Use an @supports rule or a solid colour fallback if you target very old browsers.
Yes, by animating background-position on an oversized gradient. See the Animated Gradient Background Generator.