Web4College

CSS background-color property

src

Description

CSS background-color property defines the background-color of an element.

Syntax

background-color : color-name | rgb value | hexadecimal value

Property values

color-nameDefault

Any name of the color can be used as the value of background-color. The default color of background is blue for an element.

background-color: transparent;
Try it

color-name

The following demo represents skyblue color for the background of an element.

background-color: skyblue;
Try it

rgb value

#000000

It represents rgb value of a color. The hexadecimal value of red color is given below.

background-color: rgb(255,0,0);
Try it

hexadecimal value

#000000

It represents hexadecimal notation of red color. The hexadecimal notation of blue color is given below.

background-color: #0000ff;
Try it

Applicable to

It applies to all elements