Tuesday, May 13, 2008

Color Shorthand

Once you've started using CSS layouts for your Web designs, you may observe something odd about the way the colors are distinct. Rather than the standard 6-character long code following the pound sign (#cc99ff), instead you see just three characters (#c9f). This is called color shorthand and it takes benefit of the fact that the browser-safe Web palette uses triplets that are always doubled. In other words, each color triplet is made of 3 pairs of characters 0-f (base 16), and with browser-safe colors they are doubled. So, to write color shorthand, you simply take away the duplicate character.

White is written #fff in shorthand
Black is written #000
Red is #f00
Green is #0f0
Blue is #00f
and so on...

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home