files/en-us/web/css/reference/values/blend-mode/index.md
The <blend-mode> CSS data type describes how colors should appear when elements overlap. It is used in the {{cssxref("background-blend-mode")}} and {{cssxref("mix-blend-mode")}} properties.
The <blend-mode> data type is defined using a keyword value chosen from the list below.
normal
multiply
screen
overlay
multiply if the bottom color is darker, or screen if the bottom color is lighter.
This blend mode is equivalent to hard-light but with the layers swapped.darken
lighten
color-dodge
screen, but the foreground only needs to be as light as the inverse of the backdrop to create a fully lit color.color-burn
multiply, but the foreground only needs to be as dark as the inverse of the backdrop to make the final image black.hard-light
multiply if the top color is darker, or screen if the top color is lighter.
This blend mode is equivalent to overlay but with the layers swapped.
The effect is similar to shining a harsh spotlight on the backdrop.soft-light
hard-light, but softer.
This blend mode behaves similar to hard-light.
The effect is similar to shining a diffused spotlight on the backdrop.difference
exclusion
difference, but with less contrast.
As with difference, a black layer has no effect, while a white layer inverts the other layer's color.hue
saturation
color
luminosity
color, but with the layers swapped.For each pixel among the layers to which it is applied, a blend mode takes the colors of the foreground and the background, performs a calculation on them, and returns a new color value.
Changes between blend modes are not interpolated. Any change occurs immediately.
{{csssyntax}}
<div id="div"></div>
#div {
width: 150px;
height: 150px;
background: url("br.png"), url("tr.png");
background-blend-mode: normal;
}
Set other values for background-blend-mode, you will get different results.
{{ EmbedLiveSample('Example using "normal"', "100%", "300") }}
background-blend-mode<div class="container"></div>
.container {
width: 720px;
height: 760px;
display: grid;
grid: auto-flow 190px / repeat(4, 180px);
border-top: 1px solid #d8d8d8;
border-left: 1px solid #d8d8d8;
}
.container > div {
border-right: 1px solid #d8d8d8;
border-bottom: 1px solid #d8d8d8;
}
.container div div {
margin-left: 15px;
width: 150px;
height: 150px;
background: url("br.png"), url("tr.png");
}
.container div p {
line-height: 30px;
margin: 0;
color: #a33333;
text-align: center;
}
const list = [
"normal",
"multiply",
"screen",
"overlay",
"darken",
"lighten",
"color-dodge",
"color-burn",
"hard-light",
"soft-light",
"difference",
"exclusion",
"hue",
"saturation",
"color",
"luminosity",
];
const containerElem = document.querySelector(".container");
list.forEach((item) => {
const innerElem = document.createElement("div");
innerElem.style.backgroundBlendMode = item;
const textElem = document.createElement("p");
textElem.innerText = item;
const outerElem = document.createElement("div");
outerElem.appendChild(textElem);
outerElem.appendChild(innerElem);
containerElem.appendChild(outerElem);
});
Create multiple div elements by traversing a list and set different backgroundBlendMode value for each.
{{ EmbedLiveSample('Comparison between different values with background-blend-mode', "100%", "780") }}
mix-blend-mode<div class="container"></div>
.container {
width: 640px;
height: 800px;
display: grid;
grid: auto-flow 160px / repeat(4, 160px);
border-top: 1px solid #d8d8d8;
border-left: 1px solid #d8d8d8;
}
.container > div {
border-right: 1px solid #d8d8d8;
border-bottom: 1px solid #d8d8d8;
}
.container > div > div {
position: relative;
margin-left: 20px;
width: 120px;
height: 120px;
}
.container div p {
margin: 0;
line-height: 30px;
color: #a33333;
text-align: center;
}
.circle {
width: 80px;
height: 80px;
border-radius: 50%;
mix-blend-mode: screen;
position: absolute;
}
.circle-1 {
background: red;
}
.circle-2 {
background: lightgreen;
left: 40px;
}
.circle-3 {
background: blue;
left: 20px;
top: 40px;
}
.isolate {
isolation: isolate; /* Without isolation, the background color will be taken into account */
position: relative;
}
const list = [
"normal",
"multiply",
"screen",
"overlay",
"darken",
"lighten",
"color-dodge",
"color-burn",
"hard-light",
"soft-light",
"difference",
"exclusion",
"hue",
"saturation",
"color",
"luminosity",
"plus-darker",
"plus-lighter",
];
const containerElem = document.querySelector(".container");
list.forEach((item) => {
const innerElem = document.createElement("div");
innerElem.innerHTML = `
<div class="circle circle-1"></div>
<div class="circle circle-2"></div>
<div class="circle circle-3"></div>
`;
innerElem.querySelectorAll(".circle").forEach((circle) => {
circle.style.mixBlendMode = item;
});
const textElem = document.createElement("p");
textElem.innerText = item;
const outerElem = document.createElement("div");
outerElem.appendChild(textElem);
outerElem.appendChild(innerElem);
containerElem.appendChild(outerElem);
});
In the following example, we create multiple <div> elements by traversing a list and set different mixBlendMode values for each.
{{ EmbedLiveSample('Comparison between different values with mix-blend-mode', "100%", "820") }}
In the following example, we have a <div> with two background images set on it — a Firefox logo on top of a linear gradient. Below it, we have a provided a <select> menu that allows you to change the background-blend-mode applied to the <div>, allowing you to compare the different blend mode effects.
<div></div>
<p>Choose a blend-mode:</p>
<select>
<option selected>normal</option>
<option>multiply</option>
<option>screen</option>
<option>overlay</option>
<option>darken</option>
<option>lighten</option>
<option>color-dodge</option>
<option>color-burn</option>
<option>hard-light</option>
<option>soft-light</option>
<option>difference</option>
<option>exclusion</option>
<option>hue</option>
<option>saturation</option>
<option>color</option>
<option>luminosity</option>
</select>
div {
width: 300px;
height: 300px;
background:
url("https://mdn.dev/archives/media/attachments/2020/07/29/17350/3b4892b7e820122ac6dd7678891d4507/firefox.png")
no-repeat center,
linear-gradient(to bottom, blue, orange);
}
const selectElem = document.querySelector("select");
const divElem = document.querySelector("div");
selectElem.addEventListener("change", () => {
divElem.style.backgroundBlendMode = selectElem.value;
});
{{EmbedLiveSample('Blend_mode_comparison', '100%', 400)}}
{{Specifications}}
{{Compat}}
<blend-mode> values.Description to various blend modes on other website: