CSS mix-blend-mode Property
The CSS mix-blend-mode property controls how an element's content blends with the content behind it.
It combines colors from overlapping elements to create visual effects such as darkening, lightening, contrast adjustments, and color changes. The property is useful for text overlays, images, decorative graphics, and interactive designs without modifying the original content.
mix-blend-mode Syntax
The mix-blend-mode property accepts a single blending keyword or a CSS-wide keyword.
Basic Syntax
selector {
mix-blend-mode: multiply;
}
Normal Blending
.element {
mix-blend-mode: normal;
}
Darkening and Lightening
.element {
mix-blend-mode: multiply;
}
.element {
mix-blend-mode: screen;
}
Contrast Blending
.element {
mix-blend-mode: overlay;
}
.element {
mix-blend-mode: soft-light;
}
Difference Blending
.element {
mix-blend-mode: difference;
}
.element {
mix-blend-mode: exclusion;
}
Color Blending
.element {
mix-blend-mode: hue;
}
.element {
mix-blend-mode: saturation;
}
.element {
mix-blend-mode: color;
}
.element {
mix-blend-mode: luminosity;
}
Additive Blending
.element {
mix-blend-mode: plus-lighter;
}
CSS-Wide Keywords
.element {
mix-blend-mode: initial;
}
.element {
mix-blend-mode: inherit;
}
.element {
mix-blend-mode: unset;
}
.element {
mix-blend-mode: revert;
}
.element {
mix-blend-mode: revert-layer;
}
The initial value is normal, which displays the element without applying a special blend mode.
Property Values
The following keywords determine how source colors from the element combine with backdrop colors behind it.
| Value | Description |
|---|---|
normal |
Displays the element using normal compositing without a special blend effect. |
multiply |
Multiplies source and backdrop color components, generally producing a darker result. |
screen |
Combines inverted color components, generally producing a lighter result. |
overlay |
Combines multiply and screen effects according to the backdrop color. |
darken |
Selects the darker source or backdrop component for each color channel. |
lighten |
Selects the lighter source or backdrop component for each color channel. |
color-dodge |
Brightens the backdrop according to the source color. |
color-burn |
Darkens the backdrop according to the source color. |
hard-light |
Applies a strong multiply or screen effect according to the source color. |
soft-light |
Applies a softer lighting effect that can darken or lighten the backdrop. |
difference |
Uses the absolute difference between source and backdrop color components. |
exclusion |
Creates an effect similar to difference but generally with lower contrast. |
hue |
Uses the source hue with the backdrop saturation and luminosity. |
saturation |
Uses the source saturation with the backdrop hue and luminosity. |
color |
Uses the source hue and saturation with the backdrop luminosity. |
luminosity |
Uses the source luminosity with the backdrop hue and saturation. |
plus-lighter |
Adds source and backdrop color contributions, useful for certain cross-fade effects. |
initial |
Resets the property to normal. |
inherit |
Uses the computed value from the parent element. |
unset |
Resets the property to normal because it is not inherited. |
revert |
Reverts the property according to cascade origin rules. |
revert-layer |
Reverts the property according to cascade layer rules. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | normal |
| Inherited | No |
| Applies to | All elements |
| Computed value | As specified |
| Animation type | Discrete |
| Creates stacking context | Yes, when the value is other than normal |
How It Works
Blending combines two sets of colors: the source and the backdrop.
- Source: The element whose
mix-blend-modeproperty is being applied. - Backdrop: The already-rendered content behind the source within the applicable blending group.
- Blend mode: The calculation used to combine the source and backdrop colors.
Normal Rendering
.foreground {
background-color: #2563eb;
mix-blend-mode: normal;
}
The foreground uses normal compositing. Its opaque areas cover the content behind them.
Multiply Blending
.foreground {
background-color: #2563eb;
mix-blend-mode: multiply;
}
The foreground color is multiplied with the backdrop color, creating a darker combination.
Screen Blending
.foreground {
background-color: #2563eb;
mix-blend-mode: screen;
}
The source and backdrop combine to produce a lighter result.
Blending Requires a Backdrop
The visible result depends on what appears behind the element. If the backdrop changes, the same blend mode can produce a different appearance.
For example, multiply against white produces the source color, while screen against black produces the source color.
Important Consideration
The property changes how colors are composited. It does not permanently modify an image or change the underlying HTML content.
Blend Mode Categories
Blend modes can be grouped according to their general visual effects.
Darkening Modes
These modes generally create darker color combinations.
.element {
mix-blend-mode: multiply;
}
.element {
mix-blend-mode: darken;
}
.element {
mix-blend-mode: color-burn;
}
multiply is useful for colored overlays, while darken selects darker color components. color-burn can produce stronger darkening effects.
Lightening Modes
These modes generally create lighter color combinations.
.element {
mix-blend-mode: screen;
}
.element {
mix-blend-mode: lighten;
}
.element {
mix-blend-mode: color-dodge;
}
screen is commonly used for light effects. lighten selects lighter components, while color-dodge can create intense highlights.
Contrast Modes
These modes can increase or modify contrast by combining darkening and lightening behavior.
.element {
mix-blend-mode: overlay;
}
.element {
mix-blend-mode: hard-light;
}
.element {
mix-blend-mode: soft-light;
}
overlay emphasizes backdrop contrast, hard-light produces stronger lighting effects, and soft-light creates gentler transitions.
Difference Modes
These modes compare source and backdrop colors.
.element {
mix-blend-mode: difference;
}
.element {
mix-blend-mode: exclusion;
}
difference can produce striking inverted-looking effects. exclusion generally creates a softer result.
Color Component Modes
These modes combine color characteristics rather than simply darkening or lightening.
.element {
mix-blend-mode: hue;
}
.element {
mix-blend-mode: saturation;
}
.element {
mix-blend-mode: color;
}
.element {
mix-blend-mode: luminosity;
}
They are useful for recoloring effects and controlling the relationship between color and brightness.
Additive Mode
.element {
mix-blend-mode: plus-lighter;
}
plus-lighter uses additive compositing and can help avoid unwanted darkening during overlapping opacity transitions.
Blend Mode Comparison
Different blend modes produce different results even when the source and backdrop colors remain unchanged.
Common Blend Mode Effects
| Blend Mode | Typical Effect | Common Use |
|---|---|---|
multiply |
Darkens overlapping colors | Colored overlays and layered graphics |
screen |
Lightens overlapping colors | Highlights and light effects |
overlay |
Modifies contrast | Textured and photographic effects |
darken |
Selects darker components | Combining dark graphics |
lighten |
Selects lighter components | Combining bright graphics |
soft-light |
Creates gentle lighting changes | Subtle color and texture effects |
difference |
Creates contrasting color differences | Decorative text and graphic effects |
color |
Transfers hue and saturation | Color overlays and recoloring |
luminosity |
Transfers luminosity | Brightness-based effects |
Choosing a Blend Mode
Choose a blend mode according to the desired visual effect and the colors behind the element. A mode that looks appropriate against one background may produce a very different result against another.
For predictable results, test the effect using the actual background colors, images, and transparency levels that will appear in the finished design.
Text Blending
The mix-blend-mode property can blend text with the colors or images behind it.
Difference Text
<div class="text-blend">
<h2>Creative Design</h2>
</div>
.text-blend {
display: grid;
place-items: center;
min-height: 180px;
background: linear-gradient(90deg, #111827 50%, #f8fafc 50%);
}
.text-blend h2 {
margin: 0;
color: #fff;
mix-blend-mode: difference;
}
White text using difference appears light against dark areas and dark against light areas, creating a contrasting visual effect.
Overlay Text
.overlay-heading {
color: #f97316;
mix-blend-mode: overlay;
}
The heading color interacts with the backdrop, producing a result that depends on the underlying colors.
Important Consideration
Blend modes can reduce text readability when backgrounds vary. Do not rely on blending alone to provide accessible contrast for important text.
Image Blending
Images can blend with background colors, other images, and overlapping elements.
Image with a Colored Background
<div class="image-blend">
<img src="photo.jpg" alt="Decorative landscape">
</div>
.image-blend {
background-color: #2563eb;
}
.image-blend img {
display: block;
width: 100%;
mix-blend-mode: multiply;
}
The image blends with the blue background, creating a darker color combination.
Screen Blending
.image-blend {
background-color: #1e293b;
}
.image-blend img {
mix-blend-mode: screen;
}
The image blends with the dark background to produce a lighter result.
Color Blending
.image-blend img {
mix-blend-mode: color;
}
The image contributes hue and saturation while the backdrop contributes luminosity.
Important Consideration
The image itself is not permanently changed. Removing the blend mode restores normal compositing.
Stacking Contexts and Isolation
Using a mix-blend-mode value other than normal creates a stacking context. The visible result depends on which backdrop content is available to the element.
Basic Stacking Context
.blended-element {
position: relative;
mix-blend-mode: multiply;
}
The element creates a stacking context because its blend mode is not normal.
Isolating a Blending Group
.blend-container {
isolation: isolate;
background-color: #facc15;
}
.blend-element {
background-color: #2563eb;
mix-blend-mode: multiply;
}
The isolation: isolate declaration creates an isolated stacking context. Descendant blending is restricted to the isolated group rather than blending with content outside it.
Why Isolation Matters
Without isolation, a blended element may interact with underlying page content outside the component. This can make its appearance depend on surrounding elements.
Isolation is useful for reusable components that need predictable blending behavior.
Important Consideration
Blending is affected by stacking contexts, transparency, and rendering order. The element does not necessarily blend with every visually overlapping element on the page.
Transparency and Opacity
Transparency affects how much of an element contributes to the final blended result.
Semi-Transparent Background
.overlay {
background-color: rgb(37 99 235 / 60%);
mix-blend-mode: multiply;
}
The partially transparent source color blends with the backdrop while allowing some of the underlying content to remain visible.
Element Opacity
.overlay {
background-color: #2563eb;
opacity: 0.6;
mix-blend-mode: screen;
}
The blend mode controls color interaction, while opacity controls the overall transparency of the element's rendered result.
Transparent Areas
Fully transparent areas do not contribute visible source color to the blend. Partially transparent areas contribute according to their alpha values.
Important Consideration
opacity and mix-blend-mode serve different purposes. Opacity controls transparency, while blending controls how source and backdrop colors interact.
mix-blend-mode vs. background-blend-mode
The mix-blend-mode and background-blend-mode properties both use blending operations, but they affect different parts of an element's rendering.
mix-blend-mode
.element {
background-color: #2563eb;
mix-blend-mode: multiply;
}
This blends the rendered element with the backdrop behind it.
background-blend-mode
.element {
background-image: linear-gradient(#2563eb, #f97316), url("photo.jpg");
background-blend-mode: multiply;
}
This blends the element's background layers with each other and with its background color. It does not directly blend the element's foreground content with outside elements.
Comparison
| Property | What It Blends |
|---|---|
mix-blend-mode |
The element's rendered content with its backdrop. |
background-blend-mode |
Background images and the background color within an element. |
Use mix-blend-mode for blending an element with content behind it. Use background-blend-mode for blending background layers within the same element.
mix-blend-mode Example
This example displays the same blue circle over a yellow background using four blend modes. Each mode produces a different color combination.
HTML Example
<div class="blend-demo">
<div class="blend-item">
<h3>normal</h3>
<div class="blend-stage">
<div class="blend-circle normal"></div>
</div>
</div>
<div class="blend-item">
<h3>multiply</h3>
<div class="blend-stage">
<div class="blend-circle multiply"></div>
</div>
</div>
<div class="blend-item">
<h3>screen</h3>
<div class="blend-stage">
<div class="blend-circle screen"></div>
</div>
</div>
<div class="blend-item">
<h3>difference</h3>
<div class="blend-stage">
<div class="blend-circle difference"></div>
</div>
</div>
</div>
CSS Example
.blend-demo {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 20px;
}
.blend-item h3 {
margin: 0 0 10px;
font-size: 1rem;
}
.blend-stage {
display: grid;
place-items: center;
min-height: 140px;
background-color: #facc15;
isolation: isolate;
}
.blend-circle {
width: 90px;
height: 90px;
border-radius: 50%;
background-color: #2563eb;
}
.normal {
mix-blend-mode: normal;
}
.multiply {
mix-blend-mode: multiply;
}
.screen {
mix-blend-mode: screen;
}
.difference {
mix-blend-mode: difference;
}
@media (max-width: 575px) {
.blend-demo {
grid-template-columns: 1fr;
}
}
normal
multiply
screen
difference
The normal mode displays the original blue circle. multiply creates a darker combination, screen creates a lighter combination, and difference produces contrasting colors based on the difference between the source and backdrop.
Text Blending Example
<div class="blend-text-demo">
<h2>BLEND</h2>
</div>
.blend-text-demo {
display: grid;
place-items: center;
min-height: 160px;
background: linear-gradient(90deg, #111827 50%, #fff 50%);
isolation: isolate;
}
.blend-text-demo h2 {
margin: 0;
color: #fff;
font-size: clamp(2rem, 8vw, 4rem);
font-weight: 800;
mix-blend-mode: difference;
}
BLEND
The white heading uses difference to change its appearance according to the background. The result is light over the dark half and dark over the white half.
Common Mistakes
Expecting a Blend Without a Suitable Backdrop
.element {
mix-blend-mode: multiply;
}
The result depends on the backdrop. Against white, multiply may look identical to normal rendering for an opaque source.
Confusing mix-blend-mode with background-blend-mode
mix-blend-mode blends an element with its backdrop. background-blend-mode blends background layers within the same element.
Ignoring Stacking Contexts
Stacking contexts and isolated groups affect which content is available for blending. Use isolation: isolate when a component's blending should remain independent of surrounding content.
Using Blend Modes for Essential Text Contrast
Blended text can become difficult to read when background colors or images change. Maintain sufficient contrast for important text.
Expecting Smooth Interpolation Between Blend Modes
.element {
mix-blend-mode: normal;
transition: mix-blend-mode 0.3s;
}
.element:hover {
mix-blend-mode: multiply;
}
The property uses discrete animation. The blend mode changes rather than smoothly interpolating between the two blending operations.
Assuming Opacity and Blending Are Identical
opacity controls transparency, while mix-blend-mode controls color interaction. They can be combined but do not produce equivalent effects.
Using Invalid Blend Mode Names
.element {
mix-blend-mode: darker;
}
The value darker is not a valid blend mode. Use a supported keyword such as darken or multiply.
Applying Multiple Blend Modes as a List
.element {
mix-blend-mode: multiply, screen;
}
The property accepts one blend mode, not a comma-separated list. To combine multiple effects, use separate layered elements or appropriate background blending techniques.
Important Considerations
Keep the following points in mind when using mix-blend-mode:
- The property controls how an element blends with its backdrop.
- Its initial value is
normal. - The property is not inherited.
- It applies to all elements.
- It accepts one blend mode at a time.
- The visible effect depends on the source and backdrop colors.
multiplygenerally darkens colors.screengenerally lightens colors.overlay,hard-light, andsoft-lightmodify contrast and lighting.differenceandexclusionproduce contrasting color effects.hue,saturation,color, andluminositycombine different color characteristics.plus-lighterprovides additive blending.- A value other than
normalcreates a stacking context. isolation: isolatecan restrict blending to a component's stacking context.- Transparency and opacity influence the final blended result.
background-blend-modeblends background layers rather than an element with outside content.- The property uses discrete animation rather than continuous interpolation between modes.
- Blending can affect text readability and color contrast.
- Complex blending effects can increase rendering work, particularly when large areas or animations are involved.
- Test effects against the actual backgrounds used in the finished design.
Browser Support
The CSS mix-blend-mode property is Baseline - Widely available. It is supported in current versions of major browsers, including Chrome, Edge, Firefox, and Safari.
Common blending values such as multiply, screen, overlay, and difference have broad support. Compatibility for individual blending modes and particular rendering situations may vary in older browsers.
For current compatibility information, visit Can I Use? and search for mix-blend-mode.
When using blending for important visual information, provide a readable fallback that does not depend on the effect.
Specifications
The mix-blend-mode property is defined in Compositing and Blending Level 1.
Compositing and Blending Level 1: mix-blend-mode
The specification defines how elements blend with their backdrops, including blend modes, compositing behavior, and isolated groups.
For additional documentation and examples, consult MDN Web Docs.
