1. Home
  2. Computing & Technology
  3. Web Design / HTML

background-attachment

By Jennifer Kyrnin, About.com

background-attachment Description:

The background-attachment property defines the whether a background image is fixed in relation to the canvas or if it scrolls allong with the surrounding content.

background-attachment in CSS Versions:

background-attachment Syntax:

background-attachment: scroll | fixed | inherit

  • scroll
    The standard, the image scrolls with the content.
  • fixed
    The image is fixed in relation to the canvas and the content scrolls over it.
  • repeat-y
    Repeat vertially only.
  • no-repeat
    Do not repeat the image, display it only once.
  • inherit
    The element should have the same background-attachment setting as the parent.

background-attachment Initial Value:

scroll

background-attachment Applies To:

All elements.

background-attachment Inheritance:

This property is not inherited.

background-attachment Browser Support:

background-attachment Examples:

fixed position

<p style="background-attachment : fixed; background-image : /library/graphics/purple.gif;">
This paragraph has the purple.gif image as a background that is fixed below the content.
</p>

background-attachment Special Notes:

  • The background-attachment property only reliably works in the <body> tag in many browsers.
  • This style requires a background image set.

More background-attachment Information:

Return to the Style Library

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. Style Properties
  6. CSS Style Property: background-attachment

©2008 About.com, a part of The New York Times Company.

All rights reserved.