We use cookies to improve your experience. Learn more in our Privacy policy.
background-attachment
The background-attachment CSS property determines whether the position of a background image is fixed within the viewport or scrolls with its containing block.
Example
Initial value | scroll |
Applies to | all elements in the page |
Syntax
background-attachment: fixed;
Values
The background is fixed relative to the viewport.
The background is fixed in relation to the content of the element. If the element has a scrolling mechanism, the background scrolls with the element's contents, and the background painting and positioning areas are relative to the element's scrollable area rather than the border framing them.
The background is fixed relative to the element and does not scroll with element's contents. It effectly means that it scrolls with the rest of the page.
Browser support
background-attachment | 1 | 12 | 1 | 4 | 3.5 | 1 |
fixed | 1 | 12 | 25 | 9 | 10.5 | |
local | 1 | 12 | 25 | 9 | 10.5 | |
multiple_backgrounds | 1 | 12 | 3.6 | 9 | 10.5 | 1.3 |