使用css反转颜色 [英] invert color using css

查看:123
本文介绍了使用css反转颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML

<div>
<p>inverted color</p>
</div>

CSS

div {
    background-color: #f00;
}
p { 
    color: /* how to use inverted color here in relation with div background ? */
}

有什么办法反转 p color with css?

Is there any way to invert the p color with css?

color:transparent;

推荐答案

添加背景颜色相同的颜色:$ c> color:invert;

Add the same color of the background to the paragraph and then invert with CSS3:

div {
    background-color: #f00;
}

p { 
    color: #f00;
    -webkit-filter: invert(100%);
    filter: invert(100%);
}

这篇关于使用css反转颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆