In this tutorial, you will learn how to create a gradient text and a gradient border using CSS. Animation is also added after creating the gradients. Watch the video below for a detailed tutorial.
<body>
<div class="container">
<div class="border">
<h1 class="text">Winterwind</h1>
</div>
</div>
</body>
body {
background: #2e3537;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.container {
width: 500px;
padding: 5px;
background: linear-gradient(110deg, #caf0f8 33%, rgba(0, 0, 0, 0) 33%), linear-gradient(110deg, #90e0ef 34%, #00b4d8 34%);
background-size: 400%;
animation: gradient 5s ease infinite;
}
.border {
padding: 10px;
margin: 10px;
background-color: #2e3537;
background-size: 300%;
background-position: 50% 50%;
}
.text {
font: bold 70px "Roboto", sans-serif;
text-align: center;
background: linear-gradient(110deg, #caf0f8 33%, rgba(0, 0, 0, 0) 33%), linear-gradient(110deg, #90e0ef 34%, #00b4d8 34%);
background-size: 400%;
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
animation: gradient 5s ease infinite;
}
@keyframes gradient {
0% {
background-position: 30% 50%;
}
50% {
background-position: 25% 50%;
}
100% {
background-position: 30% 50%;
}
}