Set a background color for a document:
The backgroundColor property sets or returns the background color of an element.
The backgroundColor property is supported in all major browsers.
Return the backgroundColor property:
Set the backgroundColor property:
Value | Description |
---|---|
color | Specifies the background color. Look at CSS Color Values for a complete list of possible color values |
transparent | Default. The background color is transparent (underlying content will shine through) |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | transparent |
---|---|
Return Value: | A String, representing the background color |
CSS Version | CSS1 |
Set a background color of a specific <div> element:
Return the background color of a specific <div> element:
Return the background color of a document:
CSS tutorial: CSS Background
CSS reference: background-color property
HTML DOM reference: background property