To scroll or not to scroll

background-attachment

This property controls whether or not a background image scrolls with its containing block.

Property values

One of these keyword values:

fixed The background is in a fixed position and does not scroll, even if the text above it scrolls.
scroll The background image scrolls, keeping in sync with the text placed above it.
local The background image scrolls when the whole page scrolls, but remains fixed within the local element it is attached to.

Examples

background-attachment: scroll;
background-attachment
0

style > background > background-attachmentTo scroll or not to scroll

🔗 🔎