Support0

CSS mix-blend-mode playground

Explore mix-blend-mode with high-contrast backdrops and an editable subject to see how it blends with the content behind it.

Ask AI

CSS mix-blend-mode playground

Response generated with openai/gpt-5.4-nano. AI can make mistakes. Always review the result.
BLEND
HTML
<div class="blend-scene">
  <div class="blend-subject">BLEND</div>
</div>
Tailwind CSS
Examples for Tailwind CSS 4.3 with the default theme. Custom values keep arbitrary classes when there is no equivalent utility. Changing the theme can change utility values.
<div class="grid place-items-center min-block-80 [background-color:rgb(from_#0f172a_r_g_b_/_88%)] [background-image:radial-gradient(circle_at_22%_18%,_rgb(125_211_252_/_88%)_0_18%,_transparent_19%),_radial-gradient(circle_at_78%_28%,_rgb(240_171_252_/_88%)_0_20%,_transparent_21%),_radial-gradient(circle_at_50%_82%,_rgb(134_239_172_/_88%)_0_24%,_transparent_25%)] isolate">
  <div class="mix-blend-difference text-[rgb(from_#ffffff_r_g_b_/_88%)] text-[6rem]">BLEND</div>
</div>
CSS
.blend-scene {
  display: grid;
  place-items: center;
  min-block-size: 20rem;
  background-color: rgb(from #0f172a r g b / 88%);
  background-image: radial-gradient(circle at 22% 18%, rgb(125 211 252 / 88%) 0 18%, transparent 19%), radial-gradient(circle at 78% 28%, rgb(240 171 252 / 88%) 0 20%, transparent 21%), radial-gradient(circle at 50% 82%, rgb(134 239 172 / 88%) 0 24%, transparent 25%);
  isolation: isolate;
}

.blend-subject {
  mix-blend-mode: difference;
  color: rgb(from #ffffff r g b / 88%);
  font-size: 6rem;
}

Educational guide to mix-blend-mode

How to control blending between layers

Understand what participates in mix-blend-mode, how isolation limits it, and when to keep the effect separate from text. These scenes use native CSS and are independent of the playground.

Mental model

Blending needs two inputs: the element’s pixels and the backdrop already painted behind it, within its compositing group.

  1. 1. Painted backdrop

    The container background and earlier overlapping layers.

  2. 2. Blending element

    Its content combines with that backdrop using the chosen mode.

  3. 3. Composited result

    Blending and alpha determine the visible color.

The backdrop is part of the effectStatic conceptual diagram. The same element and mode can give different results when the blending backdrop changes, even without changing the element’s CSS color.

The container matters too

The backdrop is more than background-color. It can include an image, a gradient, and siblings painted earlier. A transparent container can let outside content participate; an isolated group defines the boundary.

The painted group blends

The initial value is normal and the property is not inherited. Applying it to a container blends its painted output, including descendants. Setting normal on a child does not remove it from the effect applied to the group.

Use mix-blend-mode to combine an element with what is behind it. To blend only the background layers of one box, use background-blend-mode. To transform the element’s pixels with functions such as grayscale(), use filter.

Choosing a blend mode

Write a single keyword, not a chain of functions. First compare normal and the effect over light and dark areas.

multiply tends to darken: white leaves the backdrop unchanged and black turns it black. screen tends to lighten: black leaves the backdrop unchanged and white turns it white. difference with white inverts the backdrop channels, but does not guarantee readable text.

One circle, four modes, and the same backdrop

normal

multiply

screen

difference

Each orange circle crosses the same light and dark stripes. normal keeps the circle opaque; the other cases calculate the result with each stripe. Labels remain outside the effect.
One circle, four modes, and the same backdrop
<div class="blend-guide-modes">
  <div>
    <p>normal</p>
    <div class="blend-guide-scene" aria-hidden="true">
      <div class="blend-guide-circle normal"></div>
    </div>
  </div>
  <div>
    <p>multiply</p>
    <div class="blend-guide-scene" aria-hidden="true">
      <div class="blend-guide-circle multiply"></div>
    </div>
  </div>
  <div>
    <p>screen</p>
    <div class="blend-guide-scene" aria-hidden="true">
      <div class="blend-guide-circle screen"></div>
    </div>
  </div>
  <div>
    <p>difference</p>
    <div class="blend-guide-scene" aria-hidden="true">
      <div class="blend-guide-circle difference"></div>
    </div>
  </div>
</div>
:root {
  color-scheme: light dark;
}

.blend-guide-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;

  > div {
    flex: 1 1 10rem;
    min-inline-size: 0;
    display: grid;
    align-content: start;
    gap: 1rem;
  }

  p {
    margin: 0;
    color: light-dark(oklch(0.22 0.01 95), oklch(0.95 0.01 95));
    font: 1rem/1.6 system-ui, sans-serif;
    overflow-wrap: anywhere;
  }

  .blend-guide-scene {
    display: grid;
    place-items: center;
    min-block-size: 10rem;
    isolation: isolate;
    background: linear-gradient(90deg, #f8fafc 50%, #172554 0);
  }

  .blend-guide-circle {
    inline-size: min(6rem, 75%);
    aspect-ratio: 1;
    border-radius: 50%;
    background: light-dark(oklch(0.88 0.09 66), oklch(0.78 0.22 66));
  }

  .normal {
    mix-blend-mode: normal;
  }

  .multiply {
    mix-blend-mode: multiply;
  }

  .screen {
    mix-blend-mode: screen;
  }

  .difference {
    mix-blend-mode: difference;
  }

  @media (forced-colors: active) {
    .blend-guide-scene {
      border: 1px solid CanvasText;
      background: Canvas;
    }

    .blend-guide-circle {
      background: CanvasText;
      mix-blend-mode: normal;
    }
  }
}

Contrast and lighting

overlay · hard-light · soft-light

overlay chooses between darkening and lightening based on the backdrop; hard-light chooses based on the element. Swapping the layers can change the result. soft-light produces a gentler effect.

Comparing channels

darken · lighten · color-burn · color-dodge

darken and lighten choose the darker or lighter channels. color-burn and color-dodge produce stronger changes; check areas where detail disappears.

Color components

hue · saturation · color · luminosity

hue takes the element’s hue; saturation takes its saturation; color takes both. They retain the backdrop’s luminosity. luminosity takes the element’s luminosity and retains the backdrop’s hue and saturation.

Difference and addition

exclusion · plus-lighter

exclusion resembles difference with less contrast. plus-lighter adds contributions and clamps the result; it can serve fades with complementary opacities. It is not equivalent to screen or a general brightness adjustment.

Blending and transparency are separate operations: with partial alpha, the visible backdrop also contributes. opacity on a parent composites the whole group and creates a stacking context. To adjust only the artwork, change its color alpha or its own opacity and check the result.

Limiting the backdrop with isolation

Isolate the composition’s container, keeping the layers that should blend inside it.

isolation: isolate creates a group with a transparent initial backdrop: its children do not blend with content outside it. Layers and backgrounds painted inside still participate. In this comparison, the inner group is transparent and contains a single circle.

The same circle in a transparent group

Inner group: auto

Inner group: isolate

With auto, multiply combines the circle with the outer blue background. With isolate, that blue is outside the blending backdrop: the circle keeps its orange. Adding a background to the inner group would allow blending with it.
The same circle in a transparent group
<div class="blend-guide-isolation">
  <div>
    <p>Inner group: auto</p>
    <div class="blend-guide-outer" aria-hidden="true">
      <div class="blend-guide-inner">
        <div class="blend-guide-circle"></div>
      </div>
    </div>
  </div>
  <div>
    <p>Inner group: isolate</p>
    <div class="blend-guide-outer" aria-hidden="true">
      <div class="blend-guide-inner isolated">
        <div class="blend-guide-circle"></div>
      </div>
    </div>
  </div>
</div>
:root {
  color-scheme: light dark;
}

.blend-guide-isolation {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;

  > div {
    flex: 1 1 10rem;
    min-inline-size: 0;
    display: grid;
    align-content: start;
    gap: 1rem;
  }

  p {
    margin: 0;
    color: light-dark(oklch(0.22 0.01 95), oklch(0.95 0.01 95));
    font: 1rem/1.6 system-ui, sans-serif;
    overflow-wrap: anywhere;
  }

  .blend-guide-outer {
    isolation: isolate;
    background: light-dark(oklch(0.87 0.1 261), oklch(0.78 0.24 261));
    padding: 1rem;
  }

  .blend-guide-inner {
    display: grid;
    place-items: center;
    min-block-size: 10rem;
    background: transparent;
    isolation: auto;
  }

  .blend-guide-inner.isolated {
    isolation: isolate;
  }

  .blend-guide-circle {
    inline-size: min(6rem, 75%);
    aspect-ratio: 1;
    border-radius: 50%;
    background: light-dark(oklch(0.88 0.09 66), oklch(0.78 0.22 66));
    mix-blend-mode: multiply;
  }

  @media (forced-colors: active) {
    .blend-guide-outer {
      border: 1px solid CanvasText;
      background: Canvas;
    }

    .blend-guide-circle {
      background: CanvasText;
      mix-blend-mode: normal;
    }
  }
}

auto does not remove other contexts. If the container already creates one through transform, filter, opacity below 1, or certain z-index combinations, changing isolation may produce no visible difference. Isolation neither clips the box nor fixes its size.

Stacking and paint order

An element can only blend with layers painted behind it. An opaque layer painted later can cover the result.

A mix-blend-mode value other than normal creates a stacking context. Its children’s z-index values are resolved within that context; a large number cannot make them escape above every element on the page.

The same geometry, a different order

Blue stripe behind

Blue stripe in front

First case: the blue stripe is behind, and the circle uses multiply over it. Second case: the opaque blue stripe is in front and covers the overlap. z-index controls painting; it does not select a blending partner.
The same geometry, a different order
<div class="blend-guide-stacking">
  <div>
    <p>Blue stripe behind</p>
    <div class="blend-guide-layers" aria-hidden="true">
      <div class="blend-guide-stripe"></div>
      <div class="blend-guide-circle"></div>
    </div>
  </div>
  <div>
    <p>Blue stripe in front</p>
    <div class="blend-guide-layers covered" aria-hidden="true">
      <div class="blend-guide-stripe"></div>
      <div class="blend-guide-circle"></div>
    </div>
  </div>
</div>
:root {
  color-scheme: light dark;
}

.blend-guide-stacking {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;

  > div {
    flex: 1 1 10rem;
    min-inline-size: 0;
    display: grid;
    align-content: start;
    gap: 1rem;
  }

  p {
    margin: 0;
    color: light-dark(oklch(0.22 0.01 95), oklch(0.95 0.01 95));
    font: 1rem/1.6 system-ui, sans-serif;
    overflow-wrap: anywhere;
  }

  .blend-guide-layers {
    position: relative;
    display: grid;
    place-items: center;
    min-block-size: 10rem;
    isolation: isolate;
    background: light-dark(color-mix(in oklch, oklch(0.95 0.008 95) 98%, white), color-mix(in oklch, oklch(0.22 0.024 260) 86%, black));
  }

  .blend-guide-stripe {
    position: absolute;
    inset-inline: 0;
    inset-block-start: 40%;
    block-size: 20%;
    background: light-dark(oklch(0.87 0.1 261), oklch(0.78 0.24 261));
    z-index: 0;
  }

  .blend-guide-circle {
    inline-size: min(6rem, 75%);
    aspect-ratio: 1;
    border-radius: 50%;
    background: light-dark(oklch(0.88 0.09 66), oklch(0.78 0.22 66));
    position: relative;
    z-index: 1;
    mix-blend-mode: multiply;
  }

  .covered .blend-guide-stripe {
    z-index: 2;
  }

  @media (forced-colors: active) {
    .blend-guide-layers {
      border: 1px solid CanvasText;
      background: Canvas;
    }

    .blend-guide-stripe {
      background: CanvasText;
    }

    .blend-guide-circle {
      border: 1px solid CanvasText;
      background: Canvas;
      mix-blend-mode: normal;
    }
  }
}

position: relative alone, with z-index: auto, does not create a stacking context. Check ancestors before changing numbers: a new context can change the available backdrop. Avoid adding transform or will-change without a specific need.

Practical example: decoration and text

An isolated composition limits the effect to decorative artwork; the message retains its colors and an opaque surface.

This recipe applies multiply only to the circle and reuses the lab’s declarations for that element. The paragraph is its sibling, has its own background, and stays outside the circle’s blended group. Keep this separation when replacing the shape with an image.

Decorative blending with a readable message

The decoration blends. This message keeps its contrast.

The circle blends with the card’s gradient. The text is painted separately on an opaque surface; the whole container has no mix-blend-mode.
Decorative blending with a readable message
<div class="blend-guide-banner">
  <div class="blend-guide-art" aria-hidden="true"></div>
  <p>The decoration blends. This message keeps its contrast.</p>
</div>
:root {
  color-scheme: light dark;
}

.blend-guide-banner {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 1rem;
  isolation: isolate;
  background: linear-gradient(135deg, light-dark(oklch(0.87 0.1 261), oklch(0.78 0.24 261)), light-dark(oklch(0.86 0.11 148), oklch(0.8 0.22 148)));

  .blend-guide-art {
    background-color: light-dark(oklch(0.88 0.09 66), oklch(0.78 0.22 66));
    mix-blend-mode: multiply;
    inline-size: 6rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background-color: rgb(from light-dark(oklch(0.88 0.09 66), oklch(0.78 0.22 66)) r g b / 100%);
    max-inline-size: 100%;
  }

  p {
    margin: 0;
    padding: 1rem;
    color: light-dark(oklch(0.22 0.01 95), oklch(0.95 0.01 95));
    background: light-dark(color-mix(in oklch, oklch(0.95 0.008 95) 98%, white), color-mix(in oklch, oklch(0.22 0.024 260) 86%, black));
    font: 1rem/1.6 system-ui, sans-serif;
    overflow-wrap: anywhere;
  }

  @media (forced-colors: active) {
    border: 1px solid CanvasText;
    background: Canvas;

    .blend-guide-art {
      background: CanvasText;
      mix-blend-mode: normal;
    }
  }
}

The circle is decorative and uses aria-hidden. An informative image needs a text alternative. Check contrast on the final result in both themes and with other backdrops: difference is not an automatic contrast system for links, controls, or essential text.

Common pitfalls

Check the actual backdrop, the blended group, and the surrounding layers.

multiply seems to do nothing

Expected result
The element changes as it crosses the backdrop.
Cause
The backdrop is white, there is no overlap, or an isolated group is empty behind the element. White is neutral with multiply.
Solution
Try a colored stripe within the same group. Use normal as a reference and check geometry before blaming support.

Blending depends on the page background

Expected result
The composition keeps a local scope.
Cause
A transparent container with isolation: auto lets the outside backdrop participate if no other context limits it.
Solution
Set isolation: isolate on the container that groups the layers, and define the desired backdrop inside it.

The text changes color too

Expected result
Only the decorative image blends.
Cause
The mode is on the parent, which blends its entire group. normal on the child text cannot undo the parent’s operation.
Solution
Move mix-blend-mode to the decoration. Keep text as a sibling with colors and a background whose contrast you have checked.

A huge z-index does not fix blending

Expected result
The layer participates in the intended composition.
Cause
An ancestor creates another context, or a later layer covers the element. The index only orders within the corresponding context.
Solution
Inspect the context tree and paint order. Group the layers that should blend and isolate that group.

Background images do not blend with each other

Expected result
background-image layers combine within one box.
Cause
mix-blend-mode blends the box with its surroundings, not its backgrounds with each other.
Solution
Use background-blend-mode for those layers and reserve mix-blend-mode for overlapping elements.

Support and compatibility

Distinguish support for the property, the specific value, and the actual composition.

mix-blend-mode and isolation are Baseline Widely Available. The playground includes plus-lighter, whose support arrived in different versions from the classic modes. Check compatibility for the value you plan to reuse.

Documentation also lists plus-darker; it is not among this lab’s controls. A positive CSS.supports result only confirms that the browser accepts the syntax: it does not certify the output, contrast, or every layer combination.

If the browser ignores the mode, normal compositing remains. The recipe keeps text readable without the effect. In forced colors, these examples disable decorative blending and use system colors; labels and captions retain the explanation. They add no animations.