<div class="container">
<span data-title="HelloWorld!" class="text">
HelloWorld!
</span>
</div>
body{
@import url('https://fonts.googleapis.com/css2?family=Fjalla+One&display=swap');
margin: 0;
padding: 0;
overflow: hidden;
font-family: 'Fjalla One', sans-serif;
}
.container{
margin: 0 auto;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background-color: #d1dae3;
.text{
color: transparent;
font-size: 10vw;
display: inline-block;
border-radius: 3px;
background-color: #1d3557;
position: relative;
-webkit-background-clip: text;
background-clip: text;
&:before{
content: attr(data-title);
background: linear-gradient(90deg, rgba(245,137,21,1) 0%, rgba(253,29,29,1) 51%, rgba(29,53,87,1) 100%);
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 0;
background-clip: text;
-webkit-background-clip: text;
transition: all 1s ease-in-out;
animation: text-animation 3s infinite;
}
}
}
@keyframes text-animation{
0%{
width: 0;
}
50%{
width: 100%;
}
100%{
width: 0;
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.