★ wanayoo — archive 1999 http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/backgroundColor.aspNouvelle recherche | Portail wanayoo
MSDN Online Web Workshop   All Products  |   Support  |   Search  |   microsoft.com Home  
microsoft.com Home
  Home  |   Magazines  |   Libraries  |   Developer Centers  |   Resources  |   Downloads  |   Search MSDN
 
background-attachment Att...     background-image Attribut...     DHTML Properties    
Web Workshop  |  DHTML, HTML & CSS

background-color Attribute | backgroundColor Property


Sets or retrieves the color behind the content of the object.

Syntax

HTML{ background-color: sColor }
Scriptingobject.style.backgroundColor [ = sColor ]

Possible Values

sColor String that specifies one of the following values:
transparentColor of the next parent object through which the background is visible.
colorAny color value, including those specified in the Color Table.

The property is read/write with 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 Dynamic Properties.

Remarks

This property can be set with the other background properties by using the background composite property.

Internet Explorer 3.0 supports the background-color attribute, but only when it's set by using the background attribute.

Windows CE

In Microsoft® Windows® CE, specifying a value for the backgroundColor property of the OPTION element when applied through the style object has no effect.

Example

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.

Sample Code

<SPAN STYLE="font-size:14; background-color:beige">
. . . </SPAN>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

This example uses inline scripting to set the background color to beige.

<SPAN onmouseover="this.style.backgroundColor='beige'">
. . . </SPAN>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, currentStyle, custom, DD, defaults, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, Hn, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, OPTION, P, PLAINTEXT, PRE, runtimeStyle, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, style, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP