mix-blend-mode
Example
.logo {
mix-blend-mode: multiply;
}.card {
isolation: isolate;
}
.logo {
mix-blend-mode: multiply;
}isolation: isolate makes the card a separate group, so the logo blends only with the card's contents.
Common mistakes
- The blend affects elements far behind the card, not only its own background.
- Text with
mix-blend-mode: differencebecomes unreadable on mid-gray backgrounds.
Key points
- The blending area is limited with
isolation: isolateon the parent. - Text that relies on blending still meets contrast requirements on every background.
- Images blended with backgrounds inside one element use
background-blend-modeinstead.
Interview questions
What is the difference between mix-blend-mode and background-blend-mode?
mix-blend-mode blends an element with what is behind it. background-blend-mode blends the background layers of one element.
Does mix-blend-mode create a stacking context?
Yes. Any value other than 'normal' creates a new stacking context.