<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<ul>
<li data-text="Hello CSS3">
Hello CSS3
</li>
</ul>
</body>
</html>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
width: 100%;
min-height: 100vh;
background-color: #111;
display: flex;
justify-content: center;
align-items: center;
}
ul li{
position: relative;
display: block;
text-decoration: none;
text-transform: uppercase;
font-size: 4em;
font-weight: 800;
color: rgba(255,255,255,0.1);
}
ul li:before{
content:attr(data-text);
position: absolute;
left:0;
top:0;
background: url("./wave.png") repeat-x;
-webkit-background-clip: text;
animation: animate 2s linear infinite;
transition: 0.5s;
width:0;
overflow: hidden;
white-space: nowrap;
}
ul li:hover:before{
width:100%;
}
@keyframes animate {
0%{
background-position: 0px;
}
100%{
background-position: 200px;
}
}