Supported by all modern browsers. For detailed compatibility info see caniuse.com.
Firefox 4+
Safari 5+, Chrome 10+
Internet Explorer 9+
Opera 11+
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), which is represented by a color wheel. Ranges from 0 to 360 which both times is red. 120 is green, 240 is blue – so yellow is at 60, cyan at 180 and magenta at 300.
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.
http://www.backpack-hiking-backpacking.info salomon mens hiking
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
http://www.css3files.com Christian Krammer
These must be the coincidences of life … Glad that you found css3files.com.
http://fiendishmasterplan.com/ Chad Lundgren
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).
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.
http://www.css3files.com Christian Krammer
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.
http://www.devoth.com Łukasz Mazurek
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
http://www.css3files.com Christian Krammer
Great tool you have, Łukasz. It will surely be helpful at writing color values.
Hikaru Harada
Hello, Christian. Thanks to Very Cool reference!
You made my day.