Name

background-attachment

Values:

scroll | fixed | inherit

Initial value:

scroll

Applies to:

All elements.

Inherited:

No.

Computed value:

As specified.

Description:

This property defines whether the background image scrolls along with the element when the document is scrolled. This property can be used to create “aligned” backgrounds; for more details, see Chapter 9 of CSS: The Definitive Guide, Third Edition (O’Reilly).

Examples:

body {background-attachment: scroll;}
div.fixbg {background-attachment: fixed;}

Supported by:

Firefox, Internet Explorer, Opera, Safari.

Note:

This property is supported only for the body element in Explorer previous to IE7.

Get CSS Pocket Reference, 3rd Edition 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.