All colors in HTML are defined either as color literals or RGB color numbers. The color literals are representative names for the colors (e.g. grey). The RGB colors are 6 digit hexadecimal numbers preceded by a pound sign (#). The first two digits are the value of red, the second two are green and the last two are blue. In general, the literals are easier to use, but the exact color may vary from browser to browser. For either system, surround the literal or number with quotation marks (").

Some of the COLOR literals and their equivalent RGB values are:

LiteralColorRGB LiteralColorRGB
"#000000" "silver"
"#808080" "white"
"#8E236B" "red"
"#800080" "fuchsia"
"#32CD32" "green"
"#808000" "yellow"
"#000080" "blue"
"#008080" "cyan"
Although over 16 million colors can be represented using the RGB color system, only 216 colors are guaranteed to look the same on all browsers.

Also see the Chart of RGB colors and color literals and Hex codes.

Next Lesson Next Page