CSS2 » Properties » color

Version: Level 1

Compability: IE4+  N4+

Syntax:
color : color

The color property allows you to select the color of the text. The default is black. This property is inherited.

The color value can be the keyword color name, the hex six-digit number (#FFFFFF), or the RGB three-digit value (255,255,255). There are sixteen standard colors in HTML:
 

Color FormatsColor FormatsColor FormatsColor Formats
aqua
#00FFFF
rgb(0,255,255)
gray
#808080
rgb(128,128,128)
silver
#C0C0C0
rgb(192,192,192)
navy
#000080
rgb(0,0,128)
black
#000000
rgb(0,0,0)
green
#008000
rgb(0,128,0)
teal
#008080
rgb(0,128,128)
olive
#808000
rgb(128,128,0)
blue
#0000FF
rgb(0,0,255)
lime
#00FF00
rgb(0,255,0)
white
#FFFFFF
rgb(255,255,255)
purple
#800080
rgb(128,0,128)
fuchsia
#FF00FF
rgb(255,0,255)
maroon
#800000
rgb(128,0,0)
yellow
#FFFF00
rgb(255,255,0)
red
#FF0000
rgb(255,0,0)

 
The Guru has also created a Color Chart that displays all of the named HTML colors. In addition the hexidecimal code is provided for 256 colors.
 

Examples

Code:
p { color:  RGB(100, 14, 107); }
p { color:  #E9ACB2; }
p { color:  teal; }
Language(s): CSS2
Code:
<b>
<span style="color: fuschia;">DevGuru</span>
<span style="color: #00FF00;"> is</span>
<span style="color: RGB(256, 11, 17);"> great!</span>
</b>
Output:
DevGuru is great!
Language(s): CSS2

See Also: