DEV Community

Ed is Taking Note
Ed is Taking Note

Posted on • Edited on

3 1

[CSS trick] Create a Linear Gradient Text

  1. Set a linear gradient background for the text.
  2. Set -webkit-background-clip to text.
  3. Set the original text color to transparent.

Example:

.some-text {
  background-image: linear-gradient(to right, red, orange, yellow, green, blue, purple);
  -webkit-background-clip: text;
  color: transparent;
} 
Enter fullscreen mode Exit fullscreen mode

Result:
Image description

Top comments (1)

Collapse
 
andrewbaisden profile image
Andrew Baisden

Cool snippet.

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay