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

clipboard.png

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

阅读 5.8k
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>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题