O'Reilly logo

CSS Pocket Reference, 4th Edition by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

background-attachment

Values:

<bg-attachment> [ , <bg-attachment> ]*

Expansions:

<bg-attachment>

scroll | fixed | local

Initial value:

scroll

Applies to:

All elements

Inherited:

No

Computed value:

Same as declared value

Description:

Defines whether background images scroll 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, scroll, fixed;}
div.fixbg {background-attachment: fixed;}

Note:

In versions of Internet Explorer before IE7, this property is supported only for the body element.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required