backgroundAttachment Property

Returns or sets String that represents how the background image is displayed in the specified object. The object may be the entire document or an element within the document, such as a table. The backgroundAttachment property corresponds to the background-attachment property for a cascading style sheet.

expression.backgroundAttachment

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Remarks

The String value of the backgroundAttachment property can be one of the following:

scroll Background image scrolls with the object as the document is scrolled. For a background image applied to the entire page, the background image scrolls when the page is scrolled.
fixed Background image stays fixed within the viewable area of the object. For a background image applied to the entire page, the background image stays in a fixed position while the rest of the page scrolls up and down, left and right.

You can use the background property to set the backgroundAttachment, backgroundColor, backgroundImage, backgroundPosition, and backgroundRepeat properties. The following code shows what the example below would look like if you were using the background property to set each of these properties.

ActiveDocument.body.Style.Background = "fixed " & _
    "url(graphics/chelan.jpg) blue top center no-repeat"

Example

The following example sets the background color and image settings for the active document.

With ActiveDocument.body.Style
    .backgroundAttachment = "fixed"
    .backgroundImage = "graphics/chelan.jpg"
    .backgroundColor = "blue"
    .backgroundPosition = "top center"
    .backgroundRepeat = "no-repeat"
End With

Applies to | FPHTMLStyle Object | IFPStyleState Object | IHTMLRuleStyle Object | IHTMLStyle Object