mix-blend-mode
Sets how an element’s colours blend with what lies beneath it.
- Initial value
normal- Inherited
- No
- Animatable
- no
- Applies to
- all elements
- JavaScript
element.style.mixBlendMode = "multiply"
Example
#.cursor-title {
color: #fff;
mix-blend-mode: difference;
}<div style="position: relative; padding: 24px; border-radius: 12px; background: linear-gradient(90deg, #fff 50%, #000 50%);">
<h2 class="cursor-title" style="margin: 0; color: #fff; mix-blend-mode: difference; font-size: 32px;">Readable on both backgrounds</h2>
</div>Definition and usage
#The mix-blend-mode property works like layer blend modes in graphics programs. Instead of simply covering the background, the element combines its colours with it according to the chosen formula.
multiply darkens (white disappears, black stays), screen lightens (black disappears), overlay boosts contrast, and difference subtracts colours, giving a negative effect where the element overlaps the background.
The mode applies to blending with the content beneath the element within the same stacking context. The isolation: isolate property on a parent limits blending to its interior.
Syntax
#mix-blend-mode: normal | multiply | screen | overlay | darken | lighten | difference | exclusion | …;Values
#- The element covers the background with no blending.
- Multiplies the colours: the result is always darker.
- The opposite of multiply: the result is always lighter.
- Boosts contrast by combining multiply and screen.
- The difference of colours, an effect similar to a negative.
Values in practice
#normal
.demo { mix-blend-mode: normal; }multiply
.demo { mix-blend-mode: multiply; }screen
.demo { mix-blend-mode: screen; }overlay
.demo { mix-blend-mode: overlay; }difference
.demo { mix-blend-mode: difference; }Browser support
#Widely available
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#- The
differencemode with white text keeps the text readable on both light and dark backgrounds. - Blend modes can easily ruin contrast. Check text readability after changing the background.
Related entries
#Spotted a mistake or missing an example? Write to us.