5 out of 8 rated this helpful - Rate this topic

background-attachment property

[This documentation is preliminary and is subject to change.]

Sets or retrieves how the background image is attached to the object within the document.

Syntax

background-attachment: scroll | fixed

Property values

scroll

Default. Background image scrolls with the object as the document is scrolled.

fixed

Background image stays fixed within the viewable area of the object.

CSS information

Applies ToAll elements
Mediavisual
Inheritedno
Initial Value

Remarks

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

Examples

The following examples use the background-attachment attribute and the background-attachment 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.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/background-attachment.htm


<STYLE >
    BODY { background-attachment:fixed }
</STYLE>
</HEAD>
<BODY background="some.jpg">

This example uses inline scripting to set the background to fixed.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/backgroundAttachment.htm


<BODY ID="oBdy" background="marble05.jpg"
onload="oBdy.style.backgroundAttachment = 'fixed'">

 

 

Build date: 3/14/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ