CSS background-color property

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;

color-name

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

background-color: skyblue;

rgb value

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

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

hexadecimal value

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

background-color: #0000ff;

Applicable to

It applies to all elements

#CSS digger
Was this article helpful?

 
×

Ctrl+D