Clean • Professional
When designing modern websites, images and colors often need to interact visually with each other. Instead of just stacking them, CSS provides a powerful feature called blend modes.
Blend modes decide how the top layer blends with the background layer — creating effects similar to Photoshop. With just one CSS property, you can make colors look darker, lighter, transparent, or even create artistic effects.
A blend mode is applied when two elements (or layers) overlap. The browser calculates how the colors of the foreground (top element) should mix with the background (underneath element).
In CSS, we use the property:
mix-blend-mode: value;Example: Adding a dark tone to a hero section background.
.multiply-demo {
background: url("image.jpg") center/cover no-repeat;
mix-blend-mode: multiply;
}
Example: Textured backgrounds on banners or posters.
.overlay-demo {
background: url("image.jpg") center/cover no-repeat;
mix-blend-mode: overlay;
}
.screen-demo {
background: url("image.jpg") center/cover no-repeat;
mix-blend-mode: screen;
}
.difference-demo {
background: url("image.jpg") center/cover no-repeat;
mix-blend-mode: difference;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Blend Modes Demo</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f0f0f0;
padding: 20px;
}
h1 {
text-align: center;
margin-bottom: 40px;
}
h2 {
margin-top: 40px;
color: #333;
}
.blend-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
justify-content: center;
}
.blend-box {
width: 300px;
height: 200px;
position: relative;
border-radius: 12px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-weight: bold;
text-align: center;
font-size: 20px;
}
/* Base image overlay with different blend modes */
.multiply-demo {
background: url("<https://picsum.photos/id/1015/400/300>") center/cover no-repeat;
mix-blend-mode: multiply;
}
.overlay-demo {
background: url("<https://picsum.photos/id/1015/400/300>") center/cover no-repeat;
mix-blend-mode: overlay;
}
.screen-demo {
background: url("<https://picsum.photos/id/1015/400/300>") center/cover no-repeat;
mix-blend-mode: screen;
color: #000;
}
.difference-demo {
background: url("<https://picsum.photos/id/1015/400/300>") center/cover no-repeat;
mix-blend-mode: difference;
}
/* Optional: colored overlay to better show blend effect */
.blend-box::before {
content: '';
position: absolute;
inset: 0;
background: rgba(255, 0, 150, 0.5); /* pink overlay */
z-index: 1;
}
.blend-box span {
position: relative;
z-index: 2;
}
</style>
</head>
<body>
<h1>CSS Blend Modes Demo</h1>
<h2>Compare Different Blend Modes</h2>
<div class="blend-container">
<div class="blend-box multiply-demo">
<span>Multiply</span>
</div>
<div class="blend-box overlay-demo">
<span>Overlay</span>
</div>
<div class="blend-box screen-demo">
<span>Screen</span>
</div>
<div class="blend-box difference-demo">
<span>Difference</span>
</div>
</div>
</body>
</html>Output :
