backgroundAttachment property

Specifies how the background image (or images) is attached to the object within the document.

CSS Backgrounds and Borders Module Level 3, Section 3.5CSS 2.1, Section 14.2.1



Integer value = object.put_backgroundAttachment( v);Integer value = object.get_backgroundAttachment(* sAttachment);

Property values

Type: BSTR

scroll (scroll)

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

fixed (fixed)

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

local (local)

Internet Explorer 9 and later. Background image stays fixed with regard to the element's contents: if the element has a scrolling mechanism, the background scrolls with the element's contents.

String format

scroll | fixed | local [ , scroll | fixed | local ]*

CSS information

Applies ToAll elements
Initial Valuescroll

Standards information


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

Starting in Internet Explorer 9, the background of an element can have multiple layers. The number of layers is determined by the number of comma-separated values in the IHTMLCurrentStyle::backgroundImage property. Each of the images is sized, positioned, and tiled according to the corresponding value in the other background properties (IHTMLCurrentStyle::backgroundAttachment, IHTMLCSSStyleDeclaration::backgroundClip, IHTMLCSSStyleDeclaration::backgroundOrigin, IHTMLRuleStyle::backgroundPosition, IHTMLCurrentStyle::backgroundRepeat, and IHTMLCSSStyleDeclaration::backgroundSize). The first image in the list is the layer closest to the user, the next one is painted behind the first, and so on.

As of Internet Explorer for Windows Phone 8.1 Update, Internet Explorer for Windows Phone supports "-webkit-background-attachment" as an alias for this property.


Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003