W3docs

CSS mix-blend-mode Property

The mix-blend-mode CSS property sets the blending of background-images or background-colors. Read about the values and try examples.

The CSS mix-blend-mode property controls how an element's content blends with the content behind it — typically its parent's background-color, background-image, or another overlapping element. Instead of one layer simply covering the other, the browser combines their pixels with a mathematical formula (multiply, screen, difference, and so on), the same way blend modes work in Photoshop.

This page covers what each blend mode does, when stacking context matters, and runnable examples for the most useful values.

How blending works

For blending to be visible you need two layers to overlap — for example an <img> on top of a colored <div>. The blend mode then mixes the foreground pixels with the backdrop pixels:

  • multiply darkens — white in the foreground disappears, dark areas stay. Good for shadows and tinting.
  • screen lightens — black disappears, light areas stay. The inverse of multiply.
  • overlay combines both: it darkens dark areas and lightens light ones, boosting contrast.
  • difference / exclusion subtract colors, producing inverted, high-contrast effects.
  • hue, saturation, color, luminosity mix one channel of the foreground (its hue, saturation, etc.) with the rest of the backdrop — useful for recoloring images.

There are 16 blend modes in total (listed in the Values table below).

Stacking context and isolation

Setting any value other than normal creates a new stacking context on the element. The element blends only with content inside that stacking context — it will not blend with anything outside it. This is what stops a blended element from bleeding into the whole page.

Because of this, any property that establishes a stacking context (such as opacity below 1, transform, or position with a z-index) can change the blending result. To deliberately stop an element from blending with what is behind it, give an ancestor the isolation: isolate property — this creates a fresh stacking context so the blend is contained.

Tip

If you want to blend an element’s background images together, you can use the background-blend-mode property.

Initial Valuenormal
Applies toAll elements.
InheritedNo.
AnimatableNo.
VersionCSS1
DOM Syntaxobject.style.mixBlendMode = "exclusion";

Syntax

Syntax of CSS mix-blend-mode Property

mix-blend-mode: normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | difference | exclusion | hue | saturation | color | luminosity | initial | inherit;

Example of the mix-blend-mode property:

Example of CSS mix-blend-mode Property with multiply value

<!DOCTYPE html>
<html>
  <head>
    <title>The title of the document</title>
    <style>
      .example {
        background-color: #8ebf42;
        height: 800px;
      }
      img {
        width: 100%;
        height: auto;
        float: left;
        mix-blend-mode: multiply;
      }
    </style>
  </head>
  <body>
    <h2>Mix-blend-mode property example</h2>
    <h3>Mix-blend-mode: multiply</h3>
    <div class="example">
      <img src="/uploads/media/default/0001/01/b408569013c0bb32b2afb0f0d45e93e982347951.jpeg" alt="Tree" />
    </div>
  </body>
</html>

Example of the mix-blend-mode property with the "screen" value:

Example of CSS mix-blend-mode Property with screen value

<!DOCTYPE html>
<html>
  <head>
    <title>The title of the document</title>
    <style>
      .example {
        background-color: #8ebf42;
        height: 800px;
      }
      img {
        width: 100%;
        height: auto;
        float: left;
        mix-blend-mode: screen;
      }
    </style>
  </head>
  <body>
    <h2>Mix-blend-mode property example</h2>
    <h3>Mix-blend-mode: screen</h3>
    <div class="example">
      <img src="/uploads/media/default/0001/01/b408569013c0bb32b2afb0f0d45e93e982347951.jpeg" alt="Tree" />
    </div>
  </body>
</html>

Example of the mix-blend-mode property with the "color-dodge" value:

Example of CSS mix-blend-mode Property with color-dodge value

<!DOCTYPE html>
<html>
  <head>
    <title>The title of the document</title>
    <style>
      .example {
        background-color: #8ebf42;
        height: 800px;
      }
      img {
        width: 100%;
        height: auto;
        float: left;
        mix-blend-mode: color-dodge;
      }
    </style>
  </head>
  <body>
    <h2>Mix-blend-mode property example</h2>
    <h3>Mix-blend-mode: color-dodge</h3>
    <div class="example">
      <img src="/uploads/media/default/0001/01/b408569013c0bb32b2afb0f0d45e93e982347951.jpeg" alt="Tree" />
    </div>
  </body>
</html>

Example of the mix-blend-mode property with the "hue" value:

Example of CSS mix-blend-mode Property with hue value

<!DOCTYPE html>
<html>
  <head>
    <title>The title of the document</title>
    <style>
      .example {
        background-color: #8ebf42;
        height: 800px;
      }
      img {
        width: 100%;
        height: auto;
        float: left;
        mix-blend-mode: hue;
      }
    </style>
  </head>
  <body>
    <h2>Mix-blend-mode property example</h2>
    <h3>Mix-blend-mode: hue</h3>
    <div class="example">
      <img src="/uploads/media/default/0001/01/b408569013c0bb32b2afb0f0d45e93e982347951.jpeg" alt="Tree" />
    </div>
  </body>
</html>

Example of the mix-blend-mode property with the "normal" value:

CSS mix-blend-mode Property

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        background-color: #ff0000;
        height: 500px;
      }
      img {
        width: 50%;
        height: auto;
        float: left;
        mix-blend-mode: normal;
      }
    </style>
  </head>
  <body>
    <h2>Mix-blend-mode property example</h2>
    <h3>Mix-blend-mode: normal</h3>
    <div class="example">
      <img src="/uploads/media/default/0001/01/b408569013c0bb32b2afb0f0d45e93e982347951.jpeg" alt="Tree" width="300" height="300" />
    </div>
  </body>
</html>

Example of the mix-blend-mode with the "hard-light" value:

CSS mix-blend-mode Property

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        background-color: #ff0000;
        height: 400px;
      }
      img {
        width: 50%;
        height: auto;
        float: left;
        mix-blend-mode: hard-light;
      }
    </style>
  </head>
  <body>
    <h2>Mix-blend-mode property example</h2>
    <h3>Mix-blend-mode: hard-light</h3>
    <div class="example">
      <img src="/uploads/media/default/0001/01/b408569013c0bb32b2afb0f0d45e93e982347951.jpeg" alt="Tree" width="300" height="300" />
    </div>
  </body>
</html>

Example of the mix-blend-mode with the "difference" value:

CSS mix-blend-mode Property

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        background-color: #ff0000;
        height: 400px;
      }
      img {
        width: 50%;
        height: auto;
        float: left;
        mix-blend-mode: difference;
      }
    </style>
  </head>
  <body>
    <h2>Mix-blend-mode property example</h2>
    <h3>Mix-blend-mode: difference</h3>
    <div class="example">
      <img src="/uploads/media/default/0001/01/b408569013c0bb32b2afb0f0d45e93e982347951.jpeg" alt="Tree" width="300" height="300" />
    </div>
  </body>
</html>

Values

ValueDescription
normalNo blending — the element is painted normally on top of the backdrop. This is the default.
multiplyMultiplies the colors; the result is always darker. White has no effect, black stays black.
screenInverts, multiplies, and inverts again; the result is always lighter. The opposite of multiply.
overlaymultiply on dark areas and screen on light ones — increases contrast.
darkenKeeps the darker of the two colors for each channel.
lightenKeeps the lighter of the two colors for each channel.
color-dodgeBrightens the backdrop to reflect the foreground color.
color-burnDarkens the backdrop to reflect the foreground color.
hard-lightLike overlay but with the layers swapped — a harsh spotlight effect.
soft-lightA softer version of hard-light, like a diffused spotlight.
differenceSubtracts the darker color from the lighter one; equal colors produce black.
exclusionSimilar to difference but lower in contrast.
hueForeground hue with the backdrop's saturation and luminosity.
saturationForeground saturation with the backdrop's hue and luminosity.
colorForeground hue and saturation with the backdrop's luminosity — recolors while keeping detail.
luminosityForeground luminosity with the backdrop's hue and saturation.
initialSets the property to its default value (normal).
inheritInherits the value from the parent element.
  • background-blend-mode — blends an element's own background layers (images and color) together, rather than with what is behind the element.
  • isolation — creates a stacking context so a blend stays contained.
  • opacity and filter — other ways to alter how an element is composited.

Practice

Practice
What happens when you set mix-blend-mode to any value other than 'normal'?
What happens when you set mix-blend-mode to any value other than 'normal'?
Practice
Which blend mode always produces a darker result, where white in the foreground has no effect?
Which blend mode always produces a darker result, where white in the foreground has no effect?
Was this page helpful?