DEV Community

muneebejazz
muneebejazz

Posted on

3 2

Create beautiful gradient text in CSS with three lines of code!

In this post I will walk you through about creating gradient text in css.

Image description

You can easily add gradient to your text by adding two properties in css to the element.

h1 {
background: linear-gradient(to right, #93fd33 0%,#1A9DF4 100%);
-webkit-background-clip:text;
-webkit-text-fill-color:transparent;
}
Enter fullscreen mode Exit fullscreen mode

-webkit-background-clip:text , and -webkit-text-fill-color:transparent properties are must to add graident to your text.

Full Code


<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Text Gradient</title>
    <meta name="description" content="How to make gradient text.">
    <style>
         body {
    background-color:black;
        }
.text1 {
    font-family:'Poppins';
    font-size:192px;
    margin:100px;
    background: linear-gradient(to right, #93fd33 0%,#1A9DF4 100%);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
}


    </style>
  </head>
  <body>
    <h1 class="text1">Hello</h1>    
  </body>
</html>



Enter fullscreen mode Exit fullscreen mode

Tiugo image

Modular, Fast, and Built for Developers

CKEditor 5 gives you full control over your editing experience. A modular architecture means you get high performance, fewer re-renders and a setup that scales with your needs.

Start now

Top comments (0)

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup 🚀

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

👋 Kindness is contagious

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

Okay