A uniformly colored background

background-color

A solid or semi-transparent color is painted across the entire background of an element, underneath its text.

Property values

Specify the backgound color using any one of these color value formulas:

formula red green blue
'currentColor' Use the text's color
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);
background-color
0

style > background > background-colorA uniformly colored background

🔗 🔎