以下是CSS混合模式针对指定的“背景”元素工作的示例:
这是一个混合模式未应用于
什么情况?计算CSS混合模式时是否不考虑元素?这适用于所有浏览器吗?我是谁,为什么在这里?当尝试在具有“background-attachment: fixed”的上实现动态(通过滚动)混合时,就会出现这个问题。
更新:这似乎只适用于Chrome;Firefox / Safari的行为符合预期 - Chrome怎么了?
body {
position: relative;
}
.background {
position: absolute;
top: 0; left: 0;
height: 100%;
width: 100%;
background: linear-gradient(red, blue);
}
.blend {
background: green;
mix-blend-mode: difference;
}
<body>
<div class="background"></div>
<div class="blend">BLEND ME</div>
</body>
body
的例子:
body {
background-image: linear-gradient(red, blue);
background-size: 100%;
background-repeat: no-repeat;
}
.blend {
background: green;
mix-blend-mode: difference;
}
<body>
<div class="blend">BLEND ME</div>
</body>
更新:这似乎只适用于Chrome;Firefox / Safari的行为符合预期 - Chrome怎么了?