CSS/Properties/background-color
From W3C Wiki
< CSS | Properties
Contents |
background-color
The background-color property sets the background color of an element.
Description
| Values | <color> | transparent | inherit |
|---|---|
| Initial value | transparent |
| Applies to | All elements |
| Inherited | No |
Values
<color>
The color can be specified as a hexadecimal RGB value, a regular RGB value, or by using one of the pre-defined color keywords.
transparent
If specified, the background color is transparent. This is default.
inherit
Takes the same specified value as the property for the element's parent.
Example
Example A
[style.css]
body{
background-color: #666;
}
h1{
background-color: #ddf;
}
p{
background-color: #ccc;
}
[index.html]
<body> <h1>background example</h1> <p>This is a paragraph</p> </body>
CSS Reference
The CSS specification defines the background-color property in 14.2.1 Background properties.

