各 背景層†の混色モードを定義する。
【† background プロパティにより指定される(画像などによる)背景】
名前 | background-blend-mode
|
---|---|
値 | <blend-mode># |
初期値 | normal |
対象 | 全ての要素 |
継承 | されない |
百分率 | 受容しない |
算出値 | 指定値 |
正準的順序 | 文法に従う |
アニメーション型 | 不可 |
各 背景層は、[その層より下の層にある[要素の他の背景層]と要素の背景色]と混色されるものとする。背景層は、要素の背後にある内容と混色されないものとする。代わりに,隔離グループの中に描画されているかのように動作するものとする。
background-blend-mode リストは、background-image [CSS3BG] と同じ順序で適用されるものとする。すなわち、リストの最初の要素が、現在の前面層に適用されることになる。プロパティに与えられたカンマで分離された値の個数が,層数に満たない場合、ユーザー エージェントは、リストの値を必要なだけ繰り返して、その使用値を計算するものとする。
background 略式プロパティ [CSS3BG] が利用されたときには、当の要素に対する background-blend-mode プロパティは、その初期値に設定し直されるものとする。
次のマークアップとスタイル規則が与えられたなら:
CSS: body { background-color: lime; } div { width: 200px; height: 200px; background-size: 200px 200px; background-repeat:no-repeat; background-image: linear-gradient(to right, #000000 0%,#ffffff 100%), url('ducky.png'); background-blend-mode: difference, normal; }
HTML:
<body> <div></div> </body>
↑2 つの背景 画像の混色。
グラデーション( linear-gradient )は、body の色とは混色されないことに注意。それは元の色を維持する。
【 このコード例の ducky.png とグラデーションの順序は逆であろう(グラデーションの方が前面になっている)。この混色モードでは、結果は同じになるが。】
注記: normal 以外の混色モードを要素に適用するときは、新たな積層文脈を確立するものとする。このグループは、その要素を包含する積層文脈と伴に混色して、組成するものとする。
source:Ahiru.png:(透過) | destnation(後景): |
normal
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:normal; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(0deg, #888,#888); background-blend-mode:normal; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:normal; width:200px; height:200px; "></DIV>
multiply
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:multiply; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:multiply; width:200px; height:200px; "></DIV>
screen
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:screen; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:screen; width:200px; height:200px; "></DIV>
overlay
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:overlay; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:overlay; width:200px; height:200px; "></DIV>
darken
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:darken; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:darken; width:200px; height:200px; "></DIV>
lighten
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:lighten; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:lighten; width:200px; height:200px; "></DIV>
color-dodge
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:color-dodge; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:color-dodge; width:200px; height:200px; "></DIV>
color-burn
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:color-burn; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:color-burn; width:200px; height:200px; "></DIV>
hard-light
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:hard-light; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:hard-light; width:200px; height:200px; "></DIV>
soft-light
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:soft-light; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:soft-light; width:200px; height:200px; "></DIV>
difference
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:difference; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:difference; width:200px; height:200px; "></DIV>
exclusion
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:exclusion; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:exclusion; width:200px; height:200px; "></DIV>
hue
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:hue; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:hue; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #f00f 0%,#f000 100%); background-blend-mode:hue; width:200px; height:200px; "></DIV>
saturation
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:saturation; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:saturation; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #f00f 0%,#f000 100%); background-blend-mode:saturation; width:200px; height:200px; "></DIV>
color
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:color; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:color; width:200px; height:200px; "></DIV>
luminosity
●
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #000 0%,#fff 100%); background-blend-mode:luminosity; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), #888; background-blend-mode:luminosity; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #f00f 0%,#f000 100%); background-blend-mode:luminosity; width:200px; height:200px; "></DIV>
<DIV style="background: url('Com/Ahiru.png'), linear-gradient(to right, #f00f 0%,#000f 100%); background-blend-mode:luminosity; width:200px; height:200px; "></DIV>
表示内容: |
表示内容: |