Gab's

BLOG

CSS Gradient Text – How I Style Headings with a Color Fade

CSS Gradient Text – How I Style Headings with a Color Fade

I love adding subtle effects to my websites that make them stand out without going overboard. One simple trick I use often is gradient-colored text using CSS. It gives headers and callouts a more modern, polished feel without needing images or extra markup.

Turns out, it’s pretty easy to pull off.

How It Works

You just combine a few CSS properties to apply a background gradient directly onto the text. The idea is to:

  • Set a gradient background
  • Clip that background to the shape of the text
  • Make the actual text color transparent

Here’s What I Usually Use:

.gradient-text {
background-image: linear-gradient(45deg, #f3ec78, #af4261);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
}

Then in your HTML:

<h1 class="gradient-text">Gradient Text Example</h1>

That’s it. The text will now show the gradient instead of a solid color.

A Few Things to Know

  • This works in most modern browsers, especially Chrome and Edge.
  • Some older versions of Safari need the -webkit- prefixes (that’s why they’re in there).
  • You can experiment with different gradient directions or color combos to match your site’s vibe.

Try It Yourself

If you want to play around with different color gradients, I recommend this tool:
👉 https://cssgradient.io/blog/css-gradient-text/

It lets you tweak the gradient live and copy the code instantly.

About Me

Gabriel Dominic Oxibillo

I’m an artist with a passion for programming, blending creativity with technical expertise to deliver impactful designs. Over 7 years, I’ve mastered graphic design, creating logos, websites, animations, 3D models, social media graphics, packaging, and more, while also excelling in video editing, visual effects, game assets, and promotional materials. Proficient in Adobe Creative Suite, I combine traditional and digital techniques, and my programming skills enhance my work, particularly in web development. Detail-oriented, adaptable, and eager to learn, I thrive in collaborative environments, bringing versatile skills and a sharp eye for aesthetics to any creative team.

About me

Connect with me on

Hire me on Upwork

Email me