CSS Colors | css background color opacity
CSSsupports140+colornames,HEXvalues,RGBvalues[1],RGBAvalues,HSLvalues,HSLAvalues,andopacity.RGBAColorsRGBAcolorvaluesareanextensionofRGBcolorvalueswithanalphachannel-whichspecifiestheopacityforacolor.AnRGBAcolorvalueisspecifiedwith:rgba(red,green,blue,alpha).Thealphaparameterisanumberbetween0.0(fullytransparent)and1.0(fullyopaque).rgba(255,0,0,0.2);rgba(255,0,0,0.4);rgba(255,0,0,0.6);rgba(255,0,0,0.8);ThefollowingexampledefinesdifferentRGBAcolors:Example#p1{background-color:rgba(255,0,0,0.3)...
CSS supports 140+ color names, HEX values, RGB values[1], RGBA values, HSL values, HSLA values, and opacity.
RGBA ColorsRGBA color values are an extension of RGB color values with an alpha channel - which specifies the opacity for a color.
An RGBA color value is specified with: rgba(red, green, blue, alpha). The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque).
rgba(255, 0, 0, 0.2);
rgba(255, 0, 0, 0.4);
rgba(255, 0, 0, 0.6);
rgba(255, 0, 0, 0.8);
The following example defines different RGBA colors:
Example#p1 {background-color: rgba(255, 0, 0, 0.3);} /* red with opacity */#p2 {background-color: rgba(0, 255, 0, 0.3);} /* green with opacity */#p3 {background-color: rgba(0, 0, 255, 0.3);} /* blue with opacity */
Try it Yourself »[2] HSL ColorsHSL stands for Hue, Saturation and Lightness.
An HSL color value is specified...