Back to Snippets
CSS / TailwindCSS

CSS Gradient Text

Apply gradient colors to text using background-clip for eye-catching headings.

cssgradienttextcolor
.gradient-text {
  background: linear-gradient(135deg, text-emerald-400">"text-gray">#667eea 0%, #764ba2 50%, #f093fb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

text-emerald-400">"text-gray">/* Animated gradient */
.gradient-text-animated {
  background: linear-gradient(270deg, text-emerald-400">"text-gray">#12c2e9, #c471ed, #f64f59, #12c2e9);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-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%; }
}

How to Use

Add the .gradient-text class to any heading element. The inline-block display is needed for background-clip to work properly. Use the animated variant for attention-grabbing hero sections.

Related Technology

Tailwind CSS

Have a Project in Mind?

Let's discuss how we can bring your idea to life. From initial concept to production-ready product — we've got you covered.

or book a free call