CSS: Opacity (Transparency)
Opacity property
The Opacity property is to specify degree of transparency in a element. For the whole element.
if you just want opacity in color, use
- CSS: rgb()
- CSS: HSL Color
- color name
transparent
Opacity Syntax
Value is 0 to 1. The higher the opacity value, the more opaque.
Decimal number syntax
div { opacity: 0.9; }
Percent syntax
div { opacity: 90%; }
Opacity Example
Here is text on top of a image. The text's background has increasingly higher opacity.
0.0
0.2
0.4
0.6
0.8
1.0
Browser Support
Supported in all browsers as of 2012-04-20.
CSS Color
- CSS: color syntax. Index
- CSS: Color Names
- CSS: RGB Color
- CSS: rgb()
- CSS: HSL Color
- CSS: HWB color (hue whiteness blackness)
- CSS: what is Wide Color Gamut, Display P3, sRGB.
- CSS: LAB, LCH color
- CSS: OKLCH color
- CSS: color() function
- CSS: color-mix() function
- CSS: Opacity (Transparency)
- JS: Convert Color Names to RGB, and to HSL