Blend Modes: background-blend-mode, mix-blend-mode and isolation
How CSS mixes colors like layer modes: mix-blend-mode for blending with what's behind, multiply, screen, overlay, difference and component modes with measured results, background-blend-mode for layers, isolation, and tints and duotones.
kvi5hnuCode Sprout team member8 min readOn this page
Normally, an opaque element simply covers whatever is behind it. Blend modes mix the element's colors with the colors underneath, using the same formulas as layer modes in image editors. CSS has two properties: mix-blend-mode blends an element with its backdrop, and background-blend-mode blends an element's own background layers.
How blending works
A blend mode combines two colors for each pixel: the foreground (the element) and the backdrop (what's already painted behind it). Most modes work on each red, green and blue channel separately, as values from 0 to 1.

Every result in the diagram was measured in Chrome with a pixel check. For example, multiply's red channel is 200/255 × 60/255, which is 0.18, or 47 out of 255.
| Group | Modes | Effect |
|---|---|---|
| Darken | multiply, darken, color-burn | never lighter than the backdrop; multiply and darken are never lighter than either layer; white is neutral in multiply |
| Lighten | screen, lighten, color-dodge, plus-lighter | never darker than the backdrop; screen, lighten and plus-lighter are never darker than either layer; black is neutral in screen |
| Contrast | overlay, hard-light, soft-light | darks get darker and lights lighter; overlay decides by the backdrop, hard-light by the foreground |
| Difference | difference, exclusion | subtracts the colors; black is neutral, white inverts |
| Component | hue, saturation, color, luminosity | take some of hue, saturation and luminosity from the foreground, the rest from the backdrop |
The component modes are often the most useful for images:
colorkeeps the backdrop's luminosity with the foreground's hue and saturation, which tints a photo.luminosityis the reverse.
plus-lighter adds the channels and clips at the maximum. It's useful for cross-fading two images without a dip in brightness. Tested in Chrome: our two colors gave pure white, as every channel added to more than 255. plus-darker is Safari only.

Compare the rows with the groups in the table: multiply and darken only darken the scene, screen and lighten only lighten it, and the last row keeps the scene's lightness (hue, saturation, color) or takes the oval's (luminosity).
mix-blend-mode
mix-blend-mode blends the whole element, with its content and descendants, with everything behind it in its stacking context:
.logo-on-photo { mix-blend-mode: multiply; } /* the logo's white background disappears */
.headline { mix-blend-mode: difference; color: white; } /* inverts what's behind the text */
.tint { background: #ff3d7f; mix-blend-mode: color; } /* recolor the photo under it */
With multiply, white areas become transparent in effect, since multiplying by 1 changes nothing. That's handy for logos or scanned images with white backgrounds on colored pages. screen does the same for black backgrounds.
Things to know:
- Any value other than
normalcreates a stacking context (article 58), and makes the element a backdrop root forbackdrop-filterinside it (article 98). - Opacity scales the blend: with
opacity: 0.5, the result is halfway between the blended color and the plain backdrop. Tested in Chrome: themultiplypair from the diagram at 50% opacity gave rgb(124 81 47), halfway between rgb(47 63 43) and the backdrop. - Text that blends, such as with
difference, has unpredictable contrast: over a mid-gray, white text withdifferencebecomes mid-gray. Tested in Chrome: white withdifferenceover rgb(128 128 128) gave rgb(127 127 127), practically invisible. Check every background it can appear on, or don't use it for important text.
isolation: containing a blend
A blended element mixes with everything behind it, up to the nearest stacking context. To blend only with siblings inside a group, and not with the page behind the group, make the group isolated:
.card { isolation: isolate; } /* blends inside .card stop here */
.card .badge { mix-blend-mode: multiply; }
Tested in Chrome with a pixel check:
- A
multiplychild in a transparent parent blended with the red page behind the parent. - When the parent had
isolation: isolate, the child showed its own unblended color, since the isolated group starts with a transparent backdrop.
isolation: isolate only creates a stacking context, with no other side effects, which makes it the cleanest way to do that. Any other stacking context (transform, opacity below 1, z-index on a positioned element, filter, and so on) isolates too, so a blend that suddenly stops working often has a new stacking context above it.
background-blend-mode
background-blend-mode blends an element's background layers with each other and with its background-color. It takes a comma-separated list, one mode per image layer, in the same order as background-image:
.hero {
background-image: linear-gradient(rgb(255 61 127 / 0.9), rgb(255 61 127 / 0.9)), url(beach.jpg);
background-blend-mode: multiply, luminosity;
background-color: #1d3557;
}
Layers blend from back to front: the last image blends with the background color, then each layer in front blends with the result. Background layers are always blended in isolation. They don't mix with anything behind the element, unless the element itself also has a mix-blend-mode. Tested in Chrome: a blue gradient layer with multiply over an orange background-color gave the same rgb(47 63 43) as mix-blend-mode: multiply on overlapping elements.
Duotone images
A gradient tint keeps an image's brightness and takes its colors from a gradient, by position: the top of this image turns navy and the bottom pink.
.tinted {
background: url(portrait.jpg) center / cover, linear-gradient(#1d3557, #ff3d7f);
background-blend-mode: luminosity; /* image brightness, gradient colors */
}
A true duotone maps the image's shadows to one color and its highlights to another. Two blend layers do it: multiply turns white into the light color, and lighten turns black into the dark color:
.duo { position: relative; isolation: isolate; background: #ff3d7f; } /* highlight color */
.duo img { display: block; mix-blend-mode: multiply; filter: grayscale(1) contrast(1.2); }
.duo::after {
content: ""; position: absolute; inset: 0;
background: #1d3557; mix-blend-mode: lighten; /* shadow color */
}
An SVG filter with feColorMatrix or feComponentTransfer (article 98) can do the same in one step.

The first two panels differ only in isolation: isolate on the parent; the last two are the gradient tint and duotone recipes above, applied to the same scene.
Images in background-image have no alternative text, so keep meaningful images as <img> and use mix-blend-mode for them.
body { font: 0.8rem system-ui, sans-serif; margin: 1rem; }
.scene { /* a colorful "photo" made of gradients */
position: relative; block-size: 8rem; margin-top: 0.5rem; border-radius: 8px; overflow: hidden;
background: linear-gradient(135deg, #f6d365, #fda085 35%, #5ee7df 70%, #1d3557);
}
.layer { position: absolute; mix-blend-mode: var(--mode, multiply); }
.circle { inset: 1rem auto auto 1rem; inline-size: 6rem; block-size: 6rem; border-radius: 50%; background: #ff3d7f; }
.headline {
position: absolute; inset: auto 0.8rem 0.4rem auto; margin: 0;
font: 900 2.4rem/1 system-ui, sans-serif; color: #3a86ff; mix-blend-mode: var(--mode, multiply);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.6rem; }
.tinted {
block-size: 4rem; border-radius: 8px; color: white; font-weight: 700; padding: 0.3rem;
background: linear-gradient(90deg, #ff3d7f, #1d3557), repeating-linear-gradient(45deg, #ccc 0 8px, #666 8px 16px);
background-blend-mode: var(--mode, multiply);
}
.iso {
block-size: 4rem; border-radius: 8px; isolation: isolate;
background: repeating-linear-gradient(-45deg, #f4c95d 0 10px, #8a3b12 10px 20px);
display: grid; place-items: center;
}
.iso span { background: #5ee7df; padding: 0.3rem 0.6rem; border-radius: 4px; font-weight: 700; mix-blend-mode: var(--mode, multiply); }
Choose a mode and compare: the circle and the headline blend with the gradient scene; the left tile blends its two background layers; and the right tile's label blends only with the striped background of its isolated parent.
What's current
mix-blend-mode,background-blend-modeandisolation: all browsers.plus-lighter: all browsers;plus-darker: Safari only.
Common questions
Why doesn't my mix-blend-mode blend with the page?
An ancestor creates a stacking context, which isolates the blend. Look for transform, opacity, filter, z-index or isolation on ancestors.
How do I remove the white background of a logo image?
mix-blend-mode: multiply makes white areas show the backdrop, on light backdrops.
Do background layers blend with what's behind the element?
No. background-blend-mode blends the layers in isolation; add mix-blend-mode to blend the result with the page.
Is difference good for text over images?
It's eye-catching, but contrast varies with the image and can disappear over mid-tones. Test it, or use a solid overlay for important text.
Summary
- Blend modes combine foreground and backdrop pixels by formulas, mostly per color channel.
mix-blend-modeblends an element with everything behind it in its stacking context, and creates a stacking context itself.isolation: isolatecontains blends inside a group; any stacking context does the same.background-blend-modeblends an element's background layers back to front, in isolation from the page.- Use
multiplyto drop white backgrounds,colorandluminosityfor tints and duotones, and check contrast of blended text.
Practice questions
A logo has a white background and sits on a light yellow banner. Which blend mode makes the white disappear?
Answer
mix-blend-mode: multiply. Multiplying by white (1) leaves the backdrop unchanged, so white areas take the banner's color.
A .badge with mix-blend-mode: screen inside a card blends with the page behind the card, not just the card's background. How do you stop that?
Answer
.card { isolation: isolate; }
The card becomes a stacking context, so the badge blends only with what's painted inside it.
Write CSS that tints a background photo pink, keeping its light and dark areas.
Answer
.hero {
background: url(photo.jpg) center / cover, #ff3d7f;
background-blend-mode: luminosity;
}
The image's luminosity is combined with the pink background color's hue and saturation. multiply with a pink layer also works, but darkens.
What color does mix-blend-mode: multiply produce for an rgb(255 255 255) element over an rgb(40 80 120) backdrop?
Answer
rgb(40 80 120): white is neutral in multiply, so the backdrop shows unchanged.
Previous: Filters: blur(), drop-shadow(), Color Filters and backdrop-filter
Next: Clipping: clip-path With inset(), circle(), polygon(), path() and shape()

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.