Blending and isolation
Definition and purpose
Blending calculates a color from a source and a backdrop before compositing it. Alpha compositing instead determines how much each layer contributes according to opacity. mix-blend-mode can change the result even when the source is fully opaque.
Multiply opaque colors
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; font: 16px sans-serif; color: #172033; background: white; } #b { width: 100px; height: 80px; background: yellow; } #a { width: 80px; height: 60px; background: cyan; } #a { mix-blend-mode: multiply; } </style> </head> <body> <div id="b"> <div id="a" aria-hidden="true"></div> </div> </body></html>The overlap is green, despite full source opacity.
Syntax and mental model
Multiply multiplies corresponding normalized color channels: cyan (0,1,1) over yellow (1,1,0) produces green (0,1,0) for opaque colors. Screen instead uses the complement of the multiplied complements. isolation: isolate establishes a group so child blending does not reach unrelated content behind that group. background-blend-mode operates between an element’s own background layers and color, not between arbitrary sibling boxes.
Blend background layers
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; font: 16px sans-serif; color: #172033; background: white; } #a { width: 100px; height: 80px; background-color: yellow; background-image: linear-gradient(cyan, cyan); background-blend-mode: multiply; } </style> </head> <body> <div id="a" aria-hidden="true"></div> </body></html>The color and gradient blend inside one box.
Common mistakes
Lowering opacity is not equivalent to multiply. An isolated group still blends its own children with its own backdrop. Do not apply unpredictable blending to essential text without testing contrast.
Practice and next steps
After trying the examples, complete the linked coding exercise and review questions. Predict the result before running your code. Prerequisite: Filters and backdrop filters. Next lesson: Masking and clipping.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Blending and isolation — knowledge check
Five questions on blending and isolation.
Which mode multiplies channels?
Opaque cyan multiplied by opaque yellow produces what?
What does isolation: isolate establish?
What does background-blend-mode combine?
Does opacity replace a blend mode?