Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Body bgColor attribute

Body bgColor attribute

Body Object Reference Body object


Definition and Usage

The bgColor attribute sets or returns the value of the bgcolor attribute of the body element. x

The bgcolor attribute specifies the background color of the document.

Syntax

Set the bgColor attribute:

bodyObject.bgColor="

color

"

Return the bgColor attribute:

bodyObject.bgColor

Value Description
color Specifies the background color. See the complete A CSS color value

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the bgColor attribute


Example

Example

Return the value of the bgcolor attribute of the body element:

Try it »


Body Object Reference Body object