Make your own free website on
Lessons Community Resources Tools

Background Color

Syntax: background-color: <value>
Possible Values: <color> | transparent
Initial Value: transparent
Applies to: All elements
Inherited: No

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


BODY { background-color: blue }

H1 { background-color: #000000 }

See example in action

To help avoid conflicts with user style sheets, background-image should be specified whenever background-color is used. In most cases, background-image: none is suitable.

Authors may also use the shorthand background property, which is currently better supported than the background-color property.