On this page9 sections
  1. Learning Objectives
  2. 1. background-blend-mode
  3. 2. The Main Blend Modes
  4. 3. mix-blend-mode
  5. 4. isolation: Keep Blending Inside a Group
  6. Common Beginner Mistakes
  7. Practice Questions
  8. Practice Answers
  9. Key Takeaways

Lecture 043: Blend Modes

Category7: Advanced Styling
Lecture043 of 057
Estimated video length8 min
TargetCSS3 · any modern browser
LevelIntermediate

Blend modes mix colours the way photo editors do: multiply darkens, screen lightens, overlay adds contrast. CSS can blend an element's own background layers, or blend an element with whatever is behind it.


Learning Objectives

  • Tint images with background-blend-mode
  • Blend an element with what's behind it using mix-blend-mode
  • Know the most useful blend modes
  • Keep blending inside a group with isolation

1. background-blend-mode

Blends an element's background image with its background colour (or with other background layers).

Example

html
<style>
  .t { display: inline-block; width: 140px; height: 100px; margin: 4px; color: white; font: 12px monospace; padding: 4px;
       background: url('https://picsum.photos/id/1015/280/200') center / cover, #1971c2; }
</style>

<div class="t" style="background-blend-mode: normal;">normal</div>
<div class="t" style="background-blend-mode: multiply;">multiply</div>
<div class="t" style="background-blend-mode: screen;">screen</div>
<div class="t" style="background-blend-mode: overlay;">overlay</div>
<div class="t" style="background-blend-mode: luminosity;">luminosity</div>
<div class="t" style="background-blend-mode: color;">color</div>

multiply with a brand colour is a quick way to give every photo on a site the same tint.


2. The Main Blend Modes

ModeEffect
multiplyDarkens; white disappears
screenLightens; black disappears
overlayMore contrast: darks darker, lights lighter
darken / lightenKeeps the darker / lighter of the two colours
differenceInverts where colours differ, a striking effect
color / luminosityTakes the colour from one layer and the brightness from the other

3. mix-blend-mode

Blends an element with whatever is behind it.

Example: the heading inverts over the image:

html
<div style="position: relative; height: 160px; background: url('https://picsum.photos/id/1036/600/320') center / cover;">
  <h1 style="position: absolute; inset: 0; display: grid; place-items: center; margin: 0;
             font: 900 52px system-ui; color: white; mix-blend-mode: difference;">BLEND</h1>
</div>

Example: a logo with a white background placed on a coloured section:

html
<style>
  .logo { display: inline-block; background: white; padding: 10px 16px; font: 900 26px system-ui; color: #212529; border: 3px solid #212529; margin: 6px; }
</style>

<div style="background: #ffd43b; padding: 14px;">
  <span class="logo">LOGO</span>
  <span class="logo" style="mix-blend-mode: multiply;">LOGO</span>
</div>

The first logo keeps its white box; the second uses multiply, so the white vanishes into the yellow.


4. isolation: Keep Blending Inside a Group

css
.card { isolation: isolate; }

Elements inside .card with mix-blend-mode only blend with the card, not with the rest of the page.


Common Beginner Mistakes

1. Unreadable text. Blended text can lose contrast. Check it on every image.

2. Expecting blend modes to work on background-color alone. background-blend-mode needs at least two layers.

3. Overusing them. One subtle blend effect per page is usually enough.


Practice Questions

  1. Which property blends an element's background image with its background colour?
  2. Which property blends an element with what's behind it?
  3. Which mode makes white disappear?
  4. Which mode makes black disappear?
  5. What does isolation: isolate do?

Practice Answers

  1. background-blend-mode
  2. mix-blend-mode
  3. multiply
  4. screen
  5. It keeps blending inside that element, so children don't blend with the rest of the page.

Key Takeaways

  • background-blend-mode mixes background layers; mix-blend-mode mixes an element with what's behind it.
  • multiply darkens, screen lightens, overlay adds contrast, difference inverts.
  • isolation: isolate limits blending to a group.