CSS Click Chart

background-attachment: local

Lets you apply a "fixed" background that's fixed relative to the element on which its applied, rather than the viewport.


Affixing Images: the 'background-attachment' property on W3C

Example Code

Live Demonstration

Scroll this element and the background will stay fixed locally (i.e. it sticks with the content, rather than staying "fixed" in place). Also, if you scroll the page as a whole, the background will no longer be fixed, because the background is fixed "locally".

Browser Support

Can I Use background-attachment? Data on support for the bg-local feature across the major browsers from caniuse.com.

Tools / Polyfills

Tutorials / Articles