Design

How to Make Gradient Text: background-clip:text and Fallbacks

Gradient text can be made without images using the CSS background-clip:text property. This article explains how it works, how to set the colors and angle of linear-gradient, how to write browser support and fallbacks, where to use it effectively in headings, and readability cautions.

Published: 2026-10-16

Have you ever seen a heading or logo on a site where the text itself is filled with a color gradient? At first glance it looks like an image, but it can actually be done with CSS alone. The key is a property called background-clip: text. This article explains, step by step, what gradient text is, how to make it, and the browser-support and readability cautions to keep in mind in practice.

What Is Gradient Text

Gradient text is text whose fill (color) uses a gradient of multiple colors instead of a single color. It is often used for heading accents, brand logos, and hero-section catchphrases, giving a page a sense of richness and depth.

In the past you had to export it as an image, but today the mainstream method is to lay a gradient background on the element and clip it to the shape of the text using background-clip. The advantages of doing it in CSS are large: because the text is not turned into an image, search engines and screen readers recognize it as text, it stays sharp when enlarged, and editing the wording only requires changing the HTML.

To see which color combinations and angles look good, it is easiest to try them in the Gradient Text Generator while previewing. You can feel how the look changes each time you change a color.

How to Make It: background-clip and text-fill-color

The basics of gradient text take only a few lines of CSS. The idea is simple, in three steps: lay a gradient background on the element, clip it to the shape of the text, and make the text's own color transparent so the background shows through.

.gradient-text {
  background: linear-gradient(90deg, #ff6b6b, #4d96ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

Here is the role of each line.

  • background: specifies the gradient you want on the text. This is the color that actually shows.
  • background-clip: text: clips the background's drawing area to the "shape of the text." As a result, the background no longer appears in the empty space outside the letters.
  • text-fill-color: transparent: makes the text fill transparent so the gradient background behind it shows through. -webkit-text-fill-color is a WebKit-specific property that takes precedence over the regular color.

The key point is to write both the -webkit- prefixed and unprefixed versions. background-clip: text required a vendor prefix for a long time, so writing both is safe for compatibility. Also, specify a regular color as a fallback for environments that do not support -webkit-text-fill-color.

Setting linear-gradient: Angle and Colors

What determines the look is the content of linear-gradient(). The basic syntax is the sequence "angle (or direction), color 1, color 2, …".

linear-gradient(90deg, #ff6b6b 0%, #ffd93d 50%, #4d96ff 100%)

Here is what each part means.

  • Angle: 90deg flows left to right, 0deg bottom to top, and 45deg diagonally. You can also write the direction as a keyword like to right.
  • Colors: list two or more colors. You can use not only hex like #ff6b6b but also rgb() or hsl().
  • Color position (color stops): writing 0% or 50% after a color lets you finely control where that color appears. If omitted, they are spaced evenly.

Using three or more colors creates a complex, striking gradient, but because text has a small area, keeping it to about two or three colors often looks more readable and tidy. Avoid too much brightness difference between adjacent colors; grouping similar tones gives an elegant result. If you are unsure about the color direction, it is efficient to first build the gradient itself in the CSS Gradient Generator and reuse the generated linear-gradient() code directly for your text.

Browser Support and Fallbacks

background-clip: text works in most current major browsers (Chrome, Safari, Firefox, Edge), but many environments still require the -webkit- prefix. That is why writing both prefixed and unprefixed versions is the baseline, as shown above.

The problem is when, for some reason, the property does not take effect. If only color: transparent is applied and the background clipping fails, the worst case can occur where the text becomes transparent and completely unreadable. To prevent this, prepare a fallback.

.gradient-text {
  color: #4d96ff; /* solid color shown when unsupported */
  background: linear-gradient(90deg, #ff6b6b, #4d96ff);
  -webkit-background-clip: text;
  background-clip: text;
}

In the example above, a readable solid color is specified in color first, and the gradient is overridden only in supporting browsers. For even more robustness, you can use @supports to branch so that "transparency is applied only when background-clip: text is supported."

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .gradient-text { -webkit-text-fill-color: transparent; }
}

With this in place, unsupported environments stay a solid color and supported ones show the gradient, so you keep at least a "text is readable" state in every environment. For the fallback solid color, choose one of the gradient's colors that has enough contrast with the background.

Where to Use It in Headings

Gradient text is eye-catching, but overusing it tends to look noisy and cheap. The trick to using it effectively is to limit it to the "this is the moment" spots on a page.

  • Hero heading (h1) or catchphrase: use it as the star of the first view to convey the brand's world at a glance.
  • Logo or service name: use a consistent color scheme as an accent for proper nouns.
  • Major section headings: create a difference from the body text and guide the eye.

Conversely, it is wiser to avoid using it broadly on body text, small text, or button labels. When text is small, the gradient's transition is hard to see, and it just looks like blurred, hard-to-read color. The larger and bolder the font, the more the gradient shines, so the rule of thumb is to limit it to large heading text. When testing combinations of color and font size, adopting them after checking the actual look in the Gradient Text Generator reduces mistakes.

Readability Cautions

In exchange for its design appeal, gradient text easily harms readability and accessibility. Finally, here are the points to keep in mind.

  • Contrast with the background: because a gradient's color changes, one part may blend into the background and become hard to read. Check that both the lightest and darkest colors in the gradient keep enough contrast against the background.
  • Do not convey meaning by color alone: for users with color vision differences, the intended color difference may not come across. Keep the gradient decorative and do not rely on color alone to distinguish information.
  • Do not use it on small text: as noted, gradients lead to poor readability on small text. Use a solid color for body text.
  • Always prepare a fallback: always specify a readable solid color so the text does not disappear in unsupported environments.

Once you understand the mechanism of background-clip: text, a gradient background, and making the text color transparent, gradient text is an effect you can easily create with CSS alone. Start by building a base color scheme in the CSS Gradient Generator, then check the actual look on real text and the code in the Gradient Text Generator. Seeing and touching the mechanism is the shortcut to building both understanding and taste.

Please note that this article is intended to provide general information. CSS specifications and browser support change over time. When implementing, always check the latest official documentation and each browser's support status before deciding.

FAQ

Can gradient text be made with CSS alone?

Yes. Specify a linear-gradient background on the element, clip the background to the shape of the text with background-clip: text, and make the text fill transparent with -webkit-text-fill-color: transparent (or color: transparent). That completes gradient text without any image. For compatibility, it is safe to write both the -webkit- prefixed and unprefixed versions.

What is background-clip: text?

It is a CSS property that clips the background drawing area to the "shape of the text." With it, the gradient background laid on the element appears only within the outline of the letters, and making the text color transparent lets the background show through as the text. Many environments still require -webkit-background-clip: text alongside it.

How do I set the gradient colors and angle?

Use the form linear-gradient(angle, color1, color2, …). 90deg flows left to right and 45deg diagonally. Keeping it to about two or three colors stays readable, and writing positions like 0% or 50% (color stops) after each color lets you finely adjust where the transition happens.

Why is my gradient text not showing or unreadable?

If background-clip: text does not take effect and only color: transparent is applied, the text becomes transparent and unreadable. As a fix, specify a readable solid color in color and use @supports to apply transparency only when supported; this keeps at least a readable state in every environment.

Is what I enter in the Gradient Text Generator sent to a server?

WAZA TOOLS' Gradient Text Generator and CSS Gradient Generator run entirely in your browser, so the text and settings you enter are never sent to or stored on a server. They work on smartphones too, and you can generate code as many times as you like, for free.