Skip to content

Instantly share code, notes, and snippets.

@2thecrow
Last active February 28, 2023 20:56
Show Gist options
  • Save 2thecrow/4ad8be46da6623c71632627cd2554de9 to your computer and use it in GitHub Desktop.
Save 2thecrow/4ad8be46da6623c71632627cd2554de9 to your computer and use it in GitHub Desktop.
How to add a gradient overlay to text with CSS
https://fossheim.io/writing/posts/css-text-gradient/
.gradient-text {
/* Fallback: Set a background color. */
background-color: red;
/* Create the gradient. */
background-image: linear-gradient(45deg, #f3ec78, #af4261);
/* Set the background size and repeat properties. */
background-size: 100%;
background-repeat: repeat;
/* Use the text as a mask for the background. */
/* This will show the gradient as a text color rather than element bg. */
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-moz-background-clip: text;
-moz-text-fill-color: transparent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment