【发布时间】:2013-07-18 11:25:16
【问题描述】:
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 ? */
}
有没有办法用 CSS 反转 p 颜色?
即使在 CSS3 中也有 color: transparent; 为什么没有 color: invert;?
【问题讨论】:
-
-webkit-filter: invert(100%);
-
在this fiddle 中,我尝试结合 3 种方法:WebKit 的 CSS 过滤器、Firefox 的 SVG 过滤器,以及 IE 的
outline-color: invertinvented by Lea Verou 的绝妙技巧。不幸的是,Opera (Presto) 没有剪裁由overflow填充的区域,所以它不会在那里工作。我希望这个演示对进一步的实验仍然有用。 -
@Ronvander 链接已失效