使用mix-blend-mode
。
DEMO:
http://plnkr.co/edit/R5TBohMs1jKfsPj7zcXt?p=preview
ブレンドモードを使用するには、2つの方法があります。
background-blend-mode
は:背景の両方が同じdiv要素である場合、このプロパティはすることができ中古。
mix-blend-mode
:2つの異なる要素の背景をブレンドする場合は、mix-blend-mode
プロパティを使用できます。
コード:
HTML:
<div class="wrapper">
<div class="first"></div>
<div class="second"></div>
</div>
CSS:
div.wrapper {
position: relative;
}
div.first,
div.second {
width: 300px;
height: 200px;
position: absolute;
}
div.first {
background: url(http://images.all-free-download.com/images/graphicthumb/male_lion_193754.jpg) 0 0 no-repeat;
z-index: 9;
top: 0px;
left: 0px;
}
div.second {
background: url(http://images.all-free-download.com/images/graphicthumb/canford_school_drive_dorset_514492.jpg) 0 0 no-repeat;
z-index: 10;
mix-blend-mode: difference;
top: 30px;
left: 120px;
}
青色の背景をバナーイメージ全体またはテキストだけに広げたいですか? –