What are the different ways to represent colors in CSS?
Author: Deron Eriksson
Description: This tutorial describes the different ways to represent colors in CSS.
Tutorial created using: Windows XP
Colors can be represented in several ways is CSSW. To begin with, keyword color names can be used. For CSS2, there are 16 color keywords: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. For CSS2.1, orange is added. The following table lists the color keywords, their 3-digit and 6-digit hexadecimal representations, RGB decimal notation, RGB percent notation, and an example of the color.
As you can tell from the table above, colors can also be represented using hexadecimal notation. Hexadecimal notation takes two forms: #rrggbb and #rgb. Both forms start with a # sign. Whereas the color keywords are limited to 17 colors, the hexadecimal representation and the other representations discussed allow for a much wider variety of colors.
(Continued on page 2)