css3实现字体颜色轮换

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

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


<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 cssh3>
        <button type="button" class="but">animatebutton>
    body>
html>

你可能感兴趣的:(前端)