Colors

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
"black"
"#000000" "silver"
"#C0C0C0"
"grey"
"#808080" "white"
"#FFFFFF"
"maroon"
"#8E236B" "red"
"#FF0000"
"purple"
"#800080" "fuchsia"
"#FF00FF"
"lime"
"#32CD32" "green"
"#00FF00"
"olive"
"#808000" "yellow"
"#FFFF00"
"navy"
"#000080" "blue"
"#0000FF"
"teal"
"#008080" "cyan"
"#00FFFF"
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

HTML Home