鍍金池/ 問答/HTML5  Linux  HTML/ css根據(jù)背景色改變字體顏色

css根據(jù)背景色改變字體顏色

clipboard.png

根據(jù)背景色調(diào)整字體的顏色,當藍色的背景把字體遮住了,顏色變成白色.現(xiàn)在是遮住了一半怎么改變字體的顏色

回答
編輯回答
傲嬌范
<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>
2018年2月1日 05:59