CSS Data Type
Description
The <alpha-value> CSS data type represents the opacity level of a color or visual element, defining how transparent or opaque it appears when rendered. Rather than describing a color’s hue, saturation, or brightness, this type strictly controls how much of the underlying content shows through. An alpha value of full opacity makes the element completely solid, while a lower value increases transparency, allowing background colors, images, or text to blend visually with the foreground. This makes the type essential for layered designs, subtle overlays, shadows, and modern UI effects where depth and emphasis are communicated through translucency.
The <alpha-value> is commonly used as a component of color definitions and is interpreted as a fractional intensity applied during compositing. Internally, browsers use this value to calculate how pixels from the foreground and background are mixed together. Although the value is conceptually simple, its visual impact can be significant: even small changes can dramatically affect contrast, readability, and perceived hierarchy. Because of this, alpha values are frequently paired with color spaces that support transparency, such as <percentage>-based or numeric channels, ensuring designers can fine-tune translucency with precision.
In practice, the <alpha-value> often appears in functions and properties that influence visual blending. For example, colors that include transparency are often combined with layout and visual properties like opacity, box shadows, gradients, or backgrounds to create overlays and hover effects. While the alpha value itself applies to a color component, it differs from applying opacity to an entire element, which affects all of the element’s contents, including text and child elements. Understanding this distinction helps avoid unintended transparency side effects in complex layouts.
Code examples
Using an alpha value in an RGBA color
.card {
background-color: rgba(0, 0, 0, 0.5);
}
In this example, the background is black with a semi-transparent overlay, allowing whatever sits behind the card to partially show through.
Using an alpha value in HSL-based color
.alert {
background-color: hsla(200, 100%, 50%, 0.25);
}
Here, the alpha value softens the bright blue tone, making it suitable for subtle informational highlights.
Comparing color alpha vs. element opacity
.overlay {
background-color: rgb(255 0 0 / 0.4);
}
.faded {
opacity: 0.4;
}
The first rule applies transparency only to the background color via an alpha value, while the second fades the entire element and its contents. This illustrates how <alpha-value> provides more targeted control over transparency than element-level opacity.
Syntax
<alpha-value> = <number> | <percentage>
Values
- <number>The useful range is 0 (fully transparent) to 1.0 (fully opaque), with decimal values in between; that is, 0.5 indicates that half of the foreground color is used and half of the background color is used.
- <percentage>0% corresponds to fully transparent while 100% indicates fully opaque.
Example
Browser Support
The following information will show you the current browser support for the CSS alpha-value data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
This data type is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 2nd January 2026
