CSS propertyEffects

mix-blend-mode

Sets how an element’s colours blend with what lies beneath it.

Initial value
normal
Inherited
No
Animatable
no
Applies to
all elements
JavaScript
element.style.mixBlendMode = "multiply"
On this page

Example

#
CSS
.cursor-title {
  color: #fff;
  mix-blend-mode: difference;
}
Preview

Definition and usage

#

The mix-blend-mode property works like layer blend modes in graphics programs. Instead of simply covering the background, the element combines its colours with it according to the chosen formula.

multiply darkens (white disappears, black stays), screen lightens (black disappears), overlay boosts contrast, and difference subtracts colours, giving a negative effect where the element overlaps the background.

The mode applies to blending with the content beneath the element within the same stacking context. The isolation: isolate property on a parent limits blending to its interior.

Syntax

#
Syntax
mix-blend-mode: normal | multiply | screen | overlay | darken | lighten | difference | exclusion | …;

Values

#
  • normal

    The element covers the background with no blending.
  • multiply

    Multiplies the colours: the result is always darker.
  • screen

    The opposite of multiply: the result is always lighter.
  • overlay

    Boosts contrast by combining multiply and screen.
  • difference

    The difference of colours, an effect similar to a negative.

Values in practice

#

normal

The element covers the background with no blending.
.demo { mix-blend-mode: normal; }

multiply

Multiplies the colours: the result is always darker.
.demo { mix-blend-mode: multiply; }

screen

The opposite of multiply: the result is always lighter.
.demo { mix-blend-mode: screen; }

overlay

Boosts contrast by combining multiply and screen.
.demo { mix-blend-mode: overlay; }

difference

The difference of colours, an effect similar to a negative.
.demo { mix-blend-mode: difference; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • The difference mode with white text keeps the text readable on both light and dark backgrounds.
  • Blend modes can easily ruin contrast. Check text readability after changing the background.

Related entries

#

Spotted a mistake or missing an example? Write to us.