Last updated May 30, 2010
One of the nice things about CSS3 is that it provides more flexibility in how one specifies colors. The most talked-about addition to css is the alpha channel – a way to make colors translucent, so you can still see what’s underneath them. That’s definitely cool, but from a Web design standpoint the ablity to specify colors with HSL (Hue, Saturation, Lightness) can greatly simplify developing a consistent color scheme. “The same basic color, only darker” becomes a heck of a lot simpler with HSL.
My intent was to provide a table of which browsers supported the opacity and hsl color specifications (the way I did for border-radius), but in the end that wasn’t necessary. Here’s the lowdown:
Safari, Firefox, Chrome, and Opera: support rgba and hsla
Internet Explorer 7: epic fail
Internet Explorer 8: epic fail
I suppose I had my hopes for IE8. Oh, well. (Note to the Web-using public: the sooner you stop using Internet Explorer, the sooner the Web will start working better. I’m just saying, is all.)
The table will work as a quick-reference guide for the syntax for specifying colors with hsl and alpha values. In the examples I apply the colors to the background of a <div> element, but you can use these colors anywhere, including text. If there are any special cases or places where particular browsers get things wrong, I’d love to hear about it.
| property definition | CSS3 Specification | your browser |
|---|---|---|
| background-color:rgb(255, 0, 0); background-color:rgb(0, 255, 0); | ![]() |
|
| background-color:rgba(255, 0, 0, 1); background-color:rgba(0, 255, 0, 1); | ![]() |
|
| background-color:rgba(255, 0, 0, 0.5); background-color:rgba(0, 255, 0, 0.5); | ![]() |
|
| background-color:rgba(255, 0, 0, 0.5); background-color:transparent; | ![]() |
|
| background-color:hsl(0, 100%, 50%); background-color:hsl(120, 100%, 50%); | ![]() |
|
| background-color:hsla(0, 100%, 50%, 1); background-color:hsla(120, 100%, 50%, 1); | ![]() |
|
| background-color:hsla(0, 100%, 50%, 0.5); background-color:hsla(120, 100%, 50%, 0.5); | ![]() |
|
Incrementing hue, moving around the color wheel hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) hsla(, 100%, 50%, 1) |
||
Incrementing saturation hsla(216, , 50%, 1) hsla(216, , 50%, 1) hsla(216, , 50%, 1) hsla(216, , 50%, 1) hsla(216, , 50%, 1) hsla(216, , 50%, 1) hsla(216, , 50%, 1) hsla(216, , 50%, 1) hsla(216, , 50%, 1) hsla(216, , 50%, 1) hsla(216, , 50%, 1) |
||
Incrementing lightness hsla(216, 100%, , 1) hsla(216, 100%, , 1) hsla(216, 100%, , 1) hsla(216, 100%, , 1) hsla(216, 100%, , 1) hsla(216, 100%, , 1) hsla(216, 100%, , 1) hsla(216, 100%, , 1) hsla(216, 100%, , 1) hsla(216, 100%, , 1) hsla(216, 100%, , 1) |
||
Incrementing hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) hsla(216, 100%, 50%, ) |
||
|
.sweet_text { font-family: cursive; font-size: 170px; color: hsla(216, 100%, 50%, 0.3); } Sweet! |
||
Copyright ⓒ 2010 Jerry Seeger
All Rights reserved until I get that creative commons thing figured out.



what?! msie equals epic failure?! WHAT R U TALKIN BOUT SHUT UP
that said, this is awesome. i read very, very briefly about the coolness of css3, obviously not un-briefly enough.