Welcome Login

Css: Shorthand hexadecimal color codes (hexadecimal triple color codes)

Shorthand hex notation abbreviates 6-character RRGGBB CSS colors into 3-character RGB shorthand.

Nearly all browsers (v3+, except IE3 Mac) support shorthand hex colors.

RGB triplets can be abbreviated if each of the Red, Green, and Blue hex pairs are the same.

So when you use colors where there are three pairs, you can abbreviate each color channel using one character instead of two identical characters.


.dark-yellow {color:#ffcc00;}

can be rewritten as:

.dark-yellow {color:#fc0;}


Browsers automatically expand these three-character colors into six by replicating the R, G, and B values.

This technique saves a few bytes for each color abbreviated with shorthand hex notation.


Named color equivalent:





For more information, see here.

Created on: Friday, October 26, 2012 by Andrew Sin