共用方式為


backgroundAttachment property

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

 

Syntax

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 To All elements
Media visual
Inherited no
Initial Value scroll

Standards information

Remarks

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.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll