Lesson 18 of 50
cssCSS Blend Modes
6 mins
Course progress36%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 18 of 50
css6 mins
Keep these ideas in mind as you work through the lesson.
Blend modes let you mix a layer’s pixels with the pixels behind it, mimicking Photoshop’s blend options. They work on background layers (background-blend-mode) and on individual elements (mix-blend-mode).
/* Blend two background images */
.element {
background-image: url(img1.jpg), url(img2.jpg);
background-blend-mode: multiply; /* multiplies the colours */
}
/* Blend the element itself with what lies underneath */
.overlay {
mix-blend-mode: screen;
}
.hero {
background: url('mountain.jpg') center/cover;
color:#fff;
background-blend-mode: overlay; /* brightens shadows */
}
background-blend-mode is supported in Chrome 1+, Safari 6+, Edge 12+, Firefox 30+. mix-blend-mode has similar coverage but may behave slightly differently in Firefox (requires -moz- prefix in older versions).