On this page9 sections
Lecture 043: Blend Modes
| Category | 7: Advanced Styling |
| Lecture | 043 of 057 |
| Estimated video length | 8 min |
| Target | CSS3 · any modern browser |
| Level | Intermediate |
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
<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
| Mode | Effect |
|---|---|
multiply | Darkens; white disappears |
screen | Lightens; black disappears |
overlay | More contrast: darks darker, lights lighter |
darken / lighten | Keeps the darker / lighter of the two colours |
difference | Inverts where colours differ, a striking effect |
color / luminosity | Takes 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:
<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:
<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
.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
- Which property blends an element's background image with its background colour?
- Which property blends an element with what's behind it?
- Which mode makes white disappear?
- Which mode makes black disappear?
- What does
isolation: isolatedo?
Practice Answers
background-blend-modemix-blend-modemultiplyscreen- It keeps blending inside that element, so children don't blend with the rest of the page.
Key Takeaways
background-blend-modemixes background layers;mix-blend-modemixes an element with what's behind it.multiplydarkens,screenlightens,overlayadds contrast,differenceinverts.isolation: isolatelimits blending to a group.