CKTIS / CSS
Colors and blending in CSS
Values of type <color> specify colors for text, backgrounds, and borders. An alpha channel controls a color’s transparency, while blend modes describe how its components combine with a backdrop. These are different mechanisms that can work together.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
color: <color>; background-color: <color>; background-blend-mode: <blend-mode>; mix-blend-mode: <blend-mode>;A <color> value can use a name (red), hexadecimal notation (#ff0000), or a function such as rgb(255 0 0) or hsl(0 100% 50%). Color spaces such as lab() and oklch() are also available. The color property sets the text color; currentColor lets other properties, such as a border, reuse the element’s color.
The alpha in rgb(255 0 0 / 50%) makes that color semitransparent. 0 means fully transparent and 1 fully opaque. This differs from opacity, which affects the whole element with its contents rather than just one color.
Blending calculates a color from a source and backdrop, whereas compositing accounts for their coverage and alpha. background-blend-mode blends an element’s background layers; mix-blend-mode blends the element with its external backdrop. The multiply mode multiplies corresponding components: the example’s yellow and cyan produce green. A feature’s presence in a specification does not establish browser support; the example requires local verification.
Examples
<!doctype html>
<meta charset="utf-8">
<title>CSS colors and blending</title>
<style>
body { background: white; }
.swatch {
width: 180px;
height: 70px;
margin: 12px;
padding: 8px;
color: black;
border: 2px solid currentColor;
}
.alpha { background-color: rgb(255 0 0 / 50%); }
.blend {
background-color: rgb(255 255 0);
background-image: linear-gradient(rgb(0 255 255), rgb(0 255 255));
background-blend-mode: multiply;
}
</style>
<div class="swatch alpha">Alpha</div>
<div class="swatch blend">Multiply</div>Result
Two vertically stacked rectangles with black text and borders: Alpha has a pale pink background over white; Multiply has a green background.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.