Text color
color

Specify which color to use for the element's text.
Property values
This sets the color for the element's text. It also establishes the default color for text-decoration-color
and border-color
, unless they are explicitly provided.
Setting this property also sets the value of currentcolor
, a variable that can be used in other properties.
Use use any one of these color value formulas:
formula | red | green | blue |
---|---|---|---|
6-digit hex | #ff0000 | #00ff00 | #0000ff |
3-digit hex | #f00 | #0f0 | #00f |
RGB | rgb(255,0,0) | rgb(0,255,0) | rgb(0,0,255) |
RGBA | rgb(255,0,0,1.0) | rgb(0,255,0,1.0) | rgb(0,0,255,1.0) |
HSL | hsl(0,100,50) | hsl(120,100,50) | hsl(240,100,50) |
HSLA | hsla(0,100,50,1.0) | hsla(120,100,50,1.0) | hsla(240,100,50,1.0) |
CSS names | aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, yellow * |
The fourth item of the RGBA and HSLA formulas is a transparency/opacity value, from 0.0 (fully transparent) to 1.0 (fully opaque).
* Only the first 16 standard CSS colors are listed. There are 124 more defined in the X11 color standard.
Examples
background-color: gray;
background-color: #7f7f7f;
background-color: #777;
background-color: rgb(127,127,127);
background-color: hsl(0,0.0,50.0);