<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #333;
}
h1 {
letter-spacing: 20px;
font-size: 80px;
background: linear-gradient(to right, #000, #fff, #000);
/*渐变*/
-webkit-background-clip: text;
/*渐变文字*/
background-size: 80%;
/*范围*/
background-repeat: no-repeat;
/*不重复*/
color: transparent;
/*文字必须透明*/
animation: textRun 4s infinite linear;
}
@keyframes textRun {
0% {
background-position: -400%;
}
50% {
background-position: 400%;
}
100% {
background-position: -400%;
}
}
</style>
</head>
<body>
<h1>hello world</h1>
</body>
</html>