How to Use CSS mix-blend-mode & background-blend-mode for Photoshop-Grade Effects

The Quick Answer

Use mix-blend-mode to blend two separate DOM elements together (e.g. text blending with an image underneath), and use background-blend-mode to blend multiple background layers within a single element (e.g. a background photo and a gradient overlay). Set mix-blend-mode: difference with white text (#ffffff) to achieve the popular inverted cursor and text effect that dynamically flips black-on-white and white-on-black.

Interactive Demo Live Preview
INVERTED TEXT

Step 1: The Difference Between mix-blend-mode and background-blend-mode

While their mathematical formulas are identical, their DOM application differs fundamentally. mix-blend-mode determines how an HTML element's content composites with whatever elements sit underneath it in the document stacking context. background-blend-mode composites multiple backgrounds on the same element.

blend-modes-comparison.css
/* Composites separate child element with parent background */
.headline {
  mix-blend-mode: difference;
  color: #ffffff;
}

/* Composites multiple background layers on the same box */
.hero-card {
  background-image: url("photo.jpg"), linear-gradient(#6c63ff, #ec4899);
  background-blend-mode: multiply;
}

Step 2: The Inverted Difference Cursor & Text Effect

The difference blend mode subtracts the darker color from the lighter color. When pure white text (#ffffff) passes over a white background, it turns black; when it passes over a black background, it turns white. This creates the popular inverted cursor and navbar effect without complex JavaScript observers.

difference-cursor.css
.custom-cursor {
  position: fixed;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 9999;
}

Step 3: Knocking Out White Backgrounds from Logos with multiply

When integrating client logos supplied on flat white JPEG backgrounds, you don't need to open Photoshop. Applying mix-blend-mode: multiply multiplies RGB channel values. White (1.0) multiplied by anything leaves the underlying background completely untouched.

logo-knockout.css
.partner-logo {
  mix-blend-mode: multiply;
  /* Darkens dark areas while rendering white backgrounds transparent */
}

Step 4: Stacking Context Isolation with isolation: isolate

By default, mix-blend-mode blends with every ancestor element down to the page body. To prevent an element from unintentionally blending with the background of the entire website, declare isolation: isolate on the container to form a closed blending group.

isolation-group.css
.component-container {
  /* Prevents child blend modes from bleeding out to body background */
  isolation: isolate;
  position: relative;
}

Next-Level Addons: Elevating Your Implementation

Take this technique further by combining it with complementary design token studios and animation tools:

DUOTONE COMPOSITE

1. Spotify-Grade Duotone Filtering

Explore in Duotone Studio →

Pair screen and multiply blend modes with SVG color matrices to create iconic two-tone editorial photography.

Overlay Noise Blend

2. Textured Micro-Noise Overlays with overlay

Explore in Noise Studio →

Blend analog SVG film grain textures over composited photography using mix-blend-mode: overlay.

150%
120%

3. High-Contrast Visual Filters with CSS Filter Studio

Explore in Filter Studio →

Boost saturation and contrast underneath blend layers to amplify specular highlight transmission.

Chaam
Chaam's Pro Tip

A trick I use in almost every project: don't fight specificity battles with !important. Leverage modern CSS cascade layers (@layer) and CSS variables as design tokens—it makes dark/light theme switching and responsive tuning effortless.

Why I Built the Blend Mode Studio

I got tired of guessing values and testing browser quirks in DevTools, so I built this tool to tweak and preview values in real time with 1-click code export.

Open in Blend Mode Studio ↗

Frequently Asked Questions

Practical answers to common implementation questions, browser quirks, and performance tips.

What is the difference between mix-blend-mode and background-blend-mode in CSS?

'mix-blend-mode' dictates how an HTML DOM element blends with its sibling and ancestor elements underneath it. 'background-blend-mode' dictates how multiple background-images or gradient layers blend with each other within a single element's background.

How does mix-blend-mode: difference create an inverted color effect?

The 'difference' formula subtracts the darker color value from the lighter color value. When white (#ffffff, RGB 255,255,255) overlays black (#000000), 255 - 0 = 255 (white). When white overlays white, 255 - 255 = 0 (black). This produces an automatic color inversion.

How does mix-blend-mode: multiply remove white backgrounds from logos?

'multiply' multiplies color channels (0.0 to 1.0). Since white has a value of 1.0, multiplying any underlying color by 1.0 leaves it unchanged. Dark pixels in the logo multiply and darken, while the white background effectively disappears.

Why does mix-blend-mode sometimes bleed into unwanted parent elements and how do you isolate it?

By default, blend modes blend through all ancestral layers down to the root HTML canvas. Adding 'isolation: isolate' to a parent container creates a new stacking context that stops blend mode calculations from bleeding outside.

Does using CSS blend modes affect scrolling performance or trigger repaints?

Static blend modes are GPU-composited and have minimal impact. However, moving elements with 'mix-blend-mode: difference' (such as custom mouse follower cursors) can trigger re-compositing if adjacent elements are not isolated with 'will-change: transform' or 'isolation: isolate'.

← Back to all blog guides Launch Generator Studio →