You are here : cssCSS 3background-color

background-color - CSS 3

The background-color property sets the background color of an element.

The background of an element is the total size of the element, including padding and border (but not the margin).

Tip: Use a background color and a text color that makes the text easy to read.


Syntax

background-color: color|transparent|initial|inherit;


Example

body {
    background-color: yellow;
}

h1 {
    background-color: #00ff00;
}

p {
    background-color: rgb(255,0,255);
}


Output / Return Value


Limitations


Alternatives / See Also


Reference