Supported by all modern browsers. For detailed compatibility info see caniuse.com.
Firefox 3.6+
Safari 5+, Chrome 10+
Internet Explorer 9+
Opera 11+
Official syntax
No betas, nightlies or suchlike, only final versions. Safari includes mobile browsers based on Webkit.
General description
Can be used anywhere where color values are possible like background, border or color. Functions almost different than in Photoshop. The given example corresponds to a 30% opaque yellow.
1 The color value (hue). Ranges from 0 to 360 which both times is red.
2 The saturation of the color. Ranges from 0% to 100% where 0% is the fully desaturated color thus 50% grey. 100% represents the fully saturated color.
3 The lightness of the color. Also ranges from 0% to 100%. Only 50% represents the “real” color value set at 1. More than 50% is a lighter tint, less is a darker tint. So in contrast to Photoshop 100% is not the “real” color value but pure white. 0% is black here and there however. The given example would be 100% in Photoshop.
4 The alpha value. 0 stands for fully transparent and 1 for opaque (solid). The zero before the comma can be omitted.
For more info see the W3C site and the site at MDN (including compatibility info for older browser versions).
opacity
Sets the transparency of an element, that is how much the background shines through. In contrast to rgba it changes the transparency of the whole element instead of just the color.
For more info see the W3C site, the Safari site and the site at MDN (including compatibility info for older browser versions).
x The live view can be examined using an element inspector like Firefox’s Firebug. Many browsers already have such an inspector build in. In each case right click on the example and then select “Inspect element”. Now an area in your browser opens where you see the HTML code of the example on the left side and the CSS on the right side for further investigation.
I nosing about the web, doing a search on salomon mens hiking on Bing Wednesday, and I found your site del.icio.us poetry. Really liked it. websurfer@wrs-web.com
Very useful reference, adding this to my bookmarks!
I wrote a simple color calculator that helps with converting hex to rgb(a), hope you’ll find it useful. It generates CSS 3 ready code: http://hex2rgba.devoth.com
I nosing about the web, doing a search on salomon mens hiking on Bing Wednesday, and I found your site del.icio.us poetry. Really liked it. websurfer@wrs-web.com
These must be the coincidences of life …
Glad that you found css3files.com.
Hi Christian,
I noticed a typo in the hsla description. Hue for both hsl and hsla accepts up to 360 (which is synonymous with 0).
http://www.w3.org/TR/css3-color/#hsl-color
Thank you for the tip Chad! I oriented too much on Photoshop instead of looking at the specs, sorry.
I think you will want to add a twitter icon to your blog. I just bookmarked this url, but I had to complete it by hand. Simply my 2 cents.
What exactly do you mean? I have a general Twitter icon at the top of the page and a specific for very page/post at the bottom.
Hi Christian,
Very useful reference, adding this to my bookmarks!
I wrote a simple color calculator that helps with converting hex to rgb(a), hope you’ll find it useful. It generates CSS 3 ready code:
http://hex2rgba.devoth.com
Cheers
Great tool you have, Łukasz. It will surely be helpful at writing color values.
Hello, Christian. Thanks to Very Cool reference!
You made my day.