Name

background-attachment — NN n/a IE 4 CSS 1

Synopsis

Inherited: No

When an image is applied to the element background (with the background-image attribute), the background-attachment attribute sets how the image is attached to the document. The image can remain fixed within the viewable area of the element (the viewport), or it may scroll with the element as the document is scrolled. During scrolling, a fixed attachment looks like a stationary backdrop to rolling credits of a movie.

CSS Syntax

background-attachment: fixed | scroll

Value

The fixed value keeps the image stationary in the element viewport; the scroll value lets the image scroll with the document content.

Initial Value

scroll

Example

BODY {background-attachment: fixed}

Applies To

All elements.

Object Model Reference

IE

[window.]document.all. elementID .style.backgroundAttachment

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.