[thelist] Understanding CSS with 3 digit colors ?

Saila, Craig csaila at globeandmail.ca
Wed Aug 20 13:31:28 CDT 2003


Rob Smith wrote:
> I've been trying to beef up my CSS skills and I've noticed something
> that I'm not real familiar with. Would someone please explain to me
> why people are defining colors with only 3 hex numbers? For example:  

It's shorthand, and can be used when each of three colour values (R,G,B)
has an identical partner, so:
 #FF6688 == #F68 
 #EEEEEE == #EEE 
But values like #E5E5E5, #4169E1, #FFF0F5 cannot be shortened 

As a rule-of-thumb, Web-safe colours can be shortened, while named
colours can't. Of course, some non-Web safe colours can be shortened,
and some named ones -- like Aqua (#00FFFF) -- can be.

More at:
<http://www.w3.org/TR/CSS2/syndata.html#value-def-color>

-- 
Cheers,

Craig Saila
------------------------------------------
craig at saila.com : http://www.saila.com/
------------------------------------------ 


More information about the thelist mailing list