css3实现字体颜色轮换

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/well2049/article/details/79635030

看到animate css 的页面字体颜色竟然是变化的,特别好奇,所以就看了下源码也算是拷贝出来,单独使用了。

下面写个案例,复制过去,在浏览器打开就可以看到效果:
效果图可以在这里看

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <style type="text/css">
            .but{
                border: 2px solid #f35626;
                padding: 1.5rem;
                color: #f35626;
                -webkit-animation: hue 60s infinite linear;
                background-color: transparent;
                -webkit-appearance:none;
                border-radius: 10px;
            }
            @-webkit-keyframes hue {
              from {
                -webkit-filter: hue-rotate(0deg);
              }

              to {
                -webkit-filter: hue-rotate(-360deg);
              }
            }

            .title{
                color: #f35626;
                /*font-size: 6rem;*/
                background-image:-webkit-linear-gradient(92deg,#f35626,#feab3a);
                -webkit-animation: hue 60s infinite linear;
                -webkit-text-fill-color: transparent;
                -webkit-background-clip:text;
            }


        </style>
    </head>
    <body>
        <h3 class="title">animate css</h3>
        <button type="button" class="but">animate</button>
    </body>
</html>

猜你喜欢

转载自blog.csdn.net/well2049/article/details/79635030
今日推荐