css - div切入面具

标签 css html

我有一个 div,它是 mask 。第二个 div 应该被切割成透明的 mask 。如果背景颜色是绿色,那么div应该是绿色

<body style="background:green;">
<div style="position:fixed;width:100%;height:100%;background:red;z-index:501;"></div>
<div style="width:500px;height:500px;background:blue;position:absolute;z-index:502;"></div>
<!-- I want to make the second div in the body-color that is the green color -->
​

你能以某种方式帮助我吗?谢谢。 http://jsfiddle.net/RYKFQ/2/

最佳答案

怎么样:在第二个 Div 中根据需要设置颜色的不透明度。围绕不透明度进行调整以获得所需的 mask 效果。将第二个 div 放在具有您想要的背景颜色的父 DIV 中。可能是以下 fiddle 可能对您有所帮助。祝你好运!

http://jsfiddle.net/meetravi/AFckr/

关于css - div切入面具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10619561/

相关文章:

javascript - 在 angularjs 中调用 $window.print() 导致打印预览显示空白页

css - Font-Face 在 WebKit 中不流畅

javascript - 如何在鼠标悬停时显示滚动条?

javascript - 液体布局 IE 问题,当然(新手)

javascript - 用onclick替换不同div中的内容

javascript - jQuery 移动 : How to change data-collapsed with a button

css - dom-repeat 内的网格布局中断

javascript - 学习 HTML5 和 CSS3。我也需要 javascript 吗?

jquery - Bootstrap : vertical align to bottom/same column height

html - 具有固定位置的 DIV 以及 float DIV 不起作用