css根据背景色改变字体颜色

clipboard.png

根据背景色调整字体的颜色,当蓝色的背景把字体遮住了,颜色变成白色.现在是遮住了一半怎么改变字体的颜色

阅读 5.9k
1 个回答
<style>
        @-webkit-keyframes move {
            0%{
                -webkit-clip-path:polygon(0% 0%,0% 100%,0% 100%,0% 0%);
            }
            100%{
                -webkit-clip-path:polygon(0% 0%,0% 100%,100% 100%,100% 0%);
            }
        }
        div{
            height: 50px;
            line-height: 50px;
            text-align: center;
            font-size: 2px;
        }
        .outer{
            position: relative;
        }
        .inner{
            position: absolute;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
            color: red;
            background-color: blue;
            -webkit-clip-path:polygon(0% 0%,0% 100%,100% 100%,100% 0%);
            animation: move 1s linear 0s;
        }
    </style>
</head>
<body>
<div class="outer">
    1/22
    <div class="inner">1/22</div>
</div>
推荐问题