Abbreviated Hex Code

Thanks to Brad from the Fall 2004 Class

In CSS, you can use 3-digit Hex color codes in place of the traditional 6-digit codes. Because there is just a small difference between adjacent colors, most times you can get away with using the 3-digit code.

In your style sheet, where you would use a color like red (#FF0000), black (#000000), or blue (#0000FF), you can substitute #F00, #000 or #00F. Characters in 3-digit codes can also be duplicated to make a 6-digit code. Thus #ABC becomes #AABBCC.

With 6-digit hex colors you have 167,772,216 slightly different colors to choose from. If you use the 3-digit method you have only 4,096 colors to work with.

It is much easier to make a Chart for 4,096 colors. You can click most any square in this chart to change all the colors around the one you clicked. The white box in the middle indicates the background color.

Note: These do not work in HTML, only in style sheets.