w3tweaks.com · CSS Tutorial

CSS mix-blend-mode

Blend like Photoshop. Remove white backgrounds. Make text always readable.

Tab 1

All 16 Blend Modes — Live Explorer

Click any blend mode to apply it. Choose whether to blend the overlay box or the text with the background. Watch the visual change instantly.

Preview multiply
Aa
Apply to:
mix-blend-mode: multiply;
multiply (Darken group)
Multiplies colors. White becomes transparent. Dark colors darken further. Perfect for removing white backgrounds from logos.
COMPOSITE
normal
DARKEN GROUP
multiply
darken
color-burn
LIGHTEN GROUP
screen
lighten
color-dodge
CONTRAST GROUP
overlay
hard-light
soft-light
INVERSION GROUP
difference
exclusion
COMPONENT GROUP
hue
saturation
color
luminosity
The 5 mental model groups: Darken — multiply, darken, color-burn (make things darker; white disappears) · Lighten — screen, lighten, color-dodge (make things lighter; black disappears) · Contrast — overlay, hard-light, soft-light (boost contrast) · Inversion — difference, exclusion (invert based on difference) · Component — hue, saturation, color, luminosity (mix specific color properties)
Tab 2

5 Patterns You'll Actually Use

These are the real-world use cases — the ones worth understanding thoroughly.

🪄 multiply — Remove White Background
Without
W3
With multiply ✓
W3
.logo { mix-blend-mode: multiply; }

White on the logo becomes transparent because white × anything = anything. No Photoshop, no transparent PNG needed.

💡 screen — Text Shows Background
BLEND
.text {
  color: white;
  background: black;
  mix-blend-mode: screen;
}

Black becomes transparent with screen — so the black background disappears, leaving the white text to let the gradient show through it.

🔆 overlay — Contrast-Boosting Text
Always Visible
.title {
  color: #f59e0b;
  mix-blend-mode: overlay;
}

overlay multiplies against dark backgrounds and screens against light ones — the text automatically maintains visibility as the background changes.

⚡ difference — Always-Readable Text
ALWAYS READABLE
.text {
  color: white;
  mix-blend-mode: difference;
}

White text with difference becomes the complementary color of whatever is behind it — guaranteed to always contrast.

🔒 isolation — Contain the Blending
Without isolation
Blends with purple/blue gradient behind
With isolation: isolate
Blends only within the isolated group
.group { isolation: isolate; }
.item { mix-blend-mode: screen; }

isolation: isolate creates a new stacking context — blend modes inside only blend with each other, not with parent layers.

🖱️ difference — Cursor Inversion Effect
Move mouse over me
.cursor-dot {
  mix-blend-mode: difference;
  background: white;
}

A white circle with difference inverts whatever is under it as you move. Popular creative effect with no JavaScript logic for the inversion.

Tab 3

background-blend-mode & Advanced

background-blend-mode blends multiple background layers on the same element — the image and color blend inside the element itself.

🎨 Duotone Photo Effect
Original
Photo placeholder
Duotone ✓
.photo {
  background-image: url(photo.jpg),
    linear-gradient(#7c3aed, #0891b2);
  background-blend-mode: luminosity;
}

Stack the photo with a gradient, blend with luminosity — the photo's tones map to the gradient's colors. Two-color image effect, no image editing.

🖌️ Instant Color Tinting
.tinted {
  background-image: url(img.jpg),
    linear-gradient(#7c3aed, #7c3aed);
  background-blend-mode: multiply;
}

Blend a solid color layer with multiply — the image takes the color's tint. Change only the gradient color to switch the tint. Works great for themed galleries.

🎬 Animating mix-blend-mode
Blend mode cycling...
/* Most blend modes ARE animatable */
@keyframes cycle {
  0% { mix-blend-mode: normal }
  33% { mix-blend-mode: screen }
  66% { mix-blend-mode: multiply }
  100% { mix-blend-mode: overlay }
}

Blend modes can be animated with @keyframes — but they snap between values (no interpolation). Only normal smoothly transitions via transition (it fades in/out).

mix-blend-mode not working? Common reasons:
1. Transparent body background — blend modes on child elements don't work when body has no background. Fix: body { background: #fff; } or any color.
2. Wrong stacking context — use isolation: isolate on the parent to contain blending.
3. Overlapping elements from different parents — blend modes only work between elements that share the same stacking context (siblings or parent/child).
Read the tutorial