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.
Note: The value "inherit" is not supported in IE7 and earlier. IE8 requires a !DOCTYPE. IE9 supports "inherit".
Set the backgroundColor property:
Return the backgroundColor property:
| Value | Description |
|---|---|
| color | Specifies the background color. Look at CSS Color Values for a complete list of possible color values |
| inherit | The background color is inherited from the parent element |
| transparent | Default. The background color is transparent (underlying content will shine through) |
| Default Value: | transparent |
|---|---|
| Return Value: | A String, representing the background color |
| DOM Version | Core Level 1 |
Style Object
Your message has been sent to W3Schools.