Sets or retrieves how the background image is attached to the object within the document.
Syntax
HTML { background-attachment: sAttachment } Scripting object.style.backgroundAttachment [ = sAttachment ]
Possible Values
sAttachment String that specifies one of the following values:
scroll Background image scrolls with the object as the document is scrolled. fixed Background image stays fixed within the viewable area of the object. The property is read/write with a default value of scroll; 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.
Microsoft® Internet Explorer 3.0 supports the background-attachment attribute, but only when it's set by using the background attribute.
Example
The following examples use the background-attachment attribute and the backgroundAttachment property to set the background to "fixed", so that the background does not scroll with the text.
This example uses an inline style sheet to set the background to fixed.
Sample Code
<STYLE > BODY { background-attachment:fixed } </STYLE> </HEAD> <BODY background="some.jpg">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.This example uses inline scripting to set the background to fixed.
<BODY ID="oBdy" background="marble05.jpg" onload="oBdy.style.backgroundAttachment = 'fixed'">
Applies To
BODY, currentStyle, HTML, runtimeStyle, style