Specifies whether the background-image should scroll with the contents of the object or not.
With this property you have control over how the background image behaves when the contents of the element are scrolled (stays in a fixed position, or scrolls with the contents, as it normally does).
When a fixed value is used with background-position, the position is relative to the client window of the browser. For that reason, a fixed value is used for the body tag most of the cases.
One of the following values:
|Background image stays fixed.|
|Takes the value of this property from the computed style of the parent element.|
|Default. Background image scrolls with the contents of the object.|
Example HTML code 1:
This example illustrates the use of the background-attachment property:
Did you find this example helpful?
Supported by tags:
User Contributed Comments