background-blend-mode

Term side of the Card.
Topic: Background
Unit title: background-blend-mode
Categories: Property
Explanation side of the Card

Explanation: The property that sets how background images and colors blend together. Different blend modes like `multiply`, `screen` or `overlay` can create unique visual effects by mixing the layers in various ways.

Browser compatibility:
  • The chrome browser supports this feature starting from version 35.
  • The edge browser supports this feature starting from version 79.
  • The firefox browser supports this feature starting from version 30.
  • The safari browser supports this feature starting from version 8.
Availability: 

Example

Wrongcss
.hero {
  background: url("photo.jpg") center / cover;
  background-blend-mode: multiply;
}
Rightcss
.hero {
  background: url("photo.jpg") center / cover, #2a4d8f;
  background-blend-mode: multiply;
}

Adding a color layer gives multiply something to blend with, creating a tinted duotone photo.

Common mistakes

  • The blend mode has no effect because the element has only one background layer.
  • The background is expected to blend with the page behind it, but it only blends with its own layers.

Key points

  • The element has both a background-color and a background-image, or several images, so there is something to blend.
  • Blending inside one element uses background-blend-mode; blending with content behind the element uses mix-blend-mode.
  • Text over a blended image is checked for contrast, since blend modes change the final colors.

Interview questions

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

background-blend-mode blends the background layers of one element. mix-blend-mode blends the whole element with what is behind it.

Can I set a different blend mode for each background layer?

Yes. Give a comma-separated list of modes in the same order as the background layers.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy