聚光灯
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="new_file.css"/>
</head>
<body>
<div class="spotlight">
hello world
</div>
</body>
</html>
*{
margin: 0px;
padding: 0px;
}
body{
height: 100vh;
background-color: #333;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.spotlight{
font-size: 80px;
color: #555;
text-transform: uppercase;
position: relative;
}
.spotlight::after{
content: "hello world";
position: absolute;
top: 0px;
left: 0px;
background: linear-gradient(to right,#4158D0,#C850C0,#FFCC70);
color: transparent; /* 文字颜色透明 */
-webkit-background-clip: text; /* 只有有文字的地方才有背景色 */
animation: abc 5s linear infinite alternate;
}
@keyframes abc{
/* inset矩形 circle圆 ellipse椭圆 polygon多边形 */
from{clip-path: circle(30px at 0% 50%);}
to{clip-path: circle(30px at 100% 50%);}
}
本文来自博客园,作者:不尽人意的K,转载请注明原文链接:https://www.cnblogs.com/duan-rui/p/17003179.html