首页 > 其他分享 >聚光灯

聚光灯

时间:2022-12-24 18:47:48浏览次数:42  
标签:clip color text background 聚光灯 circle 0px

<!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%);}
}

标签:clip,color,text,background,聚光灯,circle,0px
From: https://www.cnblogs.com/duan-rui/p/17003179.html

相关文章