zoukankan      html  css  js  c++  java
  • 使用 text-fill-color 实现流光字体

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            *{margin: 0;padding: 0;}
            ._borderWrap{
                width: 180px;
                height: 150px;
                position: absolute;
                left: 23%;
                top: 25%;
            }
            ._border{
                line-height: 145px;
                text-align: center;
                font-size: 40px;
                font-weight: bolder;
                -webkit-text-fill-color: transparent;
                background-image:  -webkit-linear-gradient(left,#129835,#ece648 25%,#129835 50%,#F9E92B 75%,rgb(40, 150, 38));
                background-size: 200%,100%;
                -webkit-background-clip: text;
                -webkit-animation: word 5s linear infinite ;
            }
            @keyframes word {
                0%{background-position: 0 0}
                100%{background-position: -100% 0}
            }
    
        </style>
    </head>
    <body>
            <div class="_borderWrap">
                <div class="_border">你的名字</div>
            </div>
    </body>
    </html>


    注意,制作流光文字有几个要点:text-fill-color一般设置为transparent(透明色),然后利用background-image和渐变颜色来设置文字的背景色,
    利用background-clip来实现文字的截取,再利用background-size设置扩大背景,已使运用animation的时候能达到动画的效果等
    你的名字
  • 相关阅读:
    Webpack的学习总结(1)
    mybatis-plus逻辑删除
    vscode编译调试C/C++多文件——linux(makefile)
    vscode配置调试C/C++程序——linux环境(命令行编译)
    shell编程题(二十二)
    shell编程题(二十三)
    shell编程题(二十一)
    shell编程题(二十)
    GTK开发视频播放器
    C语言实现LRU缓存(二)
  • 原文地址:https://www.cnblogs.com/weixuechao/p/12583689.html
Copyright © 2011-2022 走看看