30
loading...
This website collects cookies to deliver better user experience
h1
element inside body or you can create any text element.<h1 class="text">gradient</h1>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: 'roboto', sans-serif;
background-color: #eee;
}
.text{
font-size: 150px;
color: #eee;
text-transform: capitalize;
}
Notice, background color and text color both are same here.
.text{
/*previous styles*/
background: linear-gradient(-45deg, #eeaa52, #e73c6f, #2394d5, #2af3b7);
background-size: 200% 200%;
}
.text{
/*previous styles*/
-webkit-background-clip: text;
}
-webkit-text-stroke
property..text{
/*previous styles*/
-webkit-text-stroke: 8px transparent;
}
here you can give any stroke color after 8px (stroke width) but by giving transparent, you are making space within the text, so our background gradient should be visible.