Sets or retrieves the color behind the content of the object.
Syntax
HTML
{ background-color : sColor }
Scripting
object.style.backgroundColor [ =sColor ]
Possible Values
sColor
Variant that
specifies or receives one of the following values.
transparent
Default. Color of the next parent object through which the background is visible.
color
Any color value, including those specified in the Color Table.
The property is read/write
for all objects except the following, for which it is read-only:
currentStyle.
The property has a default value of
transparent. The Cascading Style Sheets (CSS) attribute is
not inherited.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.
Remarks
This property can be set with the other background properties by using the background composite property.
Microsoft® Internet Explorer 3.0 supports the background-color attribute, but only when it's set by using the background attribute.
Examples
The following examples use the background-color attribute and the backgroundColor property to specify the background color.
This example uses an inline style sheet to set the background color to beige.
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
This example uses inline scripting to set the background color to beige.
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
Standards Information
property is defined in
Cascading Style Sheets (CSS), Level 1 (CSS1) .