渐变文字效果
效果图:颜色会律动
HTML代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>渐变文字</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<p>我轻轻的招手,作别西天的云彩。</p>
</body>
</html>
CSS代码
*{
padding: 0;
margin: 0;
}
body{
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
p{
font-size: 90px;
font-weight: 700;
font-family: '思源黑体 CN';
background-image:
linear-gradient(90deg,
#673ab7,
#e91e63);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
background-image:
linear-gradient(90deg,
rgb(255, 167, 69),
rgb(254, 134, 159),
rgb(239, 122, 200),
rgb(160, 131, 237),
rgb(67, 174, 255),
rgb(160, 131, 237),
rgb(239, 122, 200),
rgb(254, 134, 159),
rgb(255, 167, 69));
background-size: 200%;
}
p{
-webkit-animation: streamer 2s linear infinite;
animation: streamer 2s linear infinite;
}
@-webkit-keyframes streamer {
0%{
background-position: 0%;
}
100%{
background-position: 200%;
}
}
@keyframes streamer {
0%{
background-position: 0%;
}
100%{
background-position: 200%;
}
}
r {
0%{
background-position: 0%;
}
100%{
background-position: 200%;
}
}