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: 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.
scroll
All elements.
This property is not inherited.
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>
- The background-attachment property only reliably works in the <body> tag in many browsers.
- This style requires a background image set.

