The background-attachment property determines if the background image should scroll along with the content or remain fixed in place (not scrolling with the rest of the page).
Example
Indicate that the background image should remain fixed.
body { background-image: url(“img_tree.png”); background-repeat: no-repeat; background-position: right top; background-attachment: fixed; } |
Example
Indicate that the background image should move along with the page’s scrolling.
body { background-image: url(“img_tree.png”); background-repeat: no-repeat; background-position: right top; background-attachment: scroll; } |
Property |
Description |
background attachment |
Specifies if a background image remains fixed or moves with page scrolling. |