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-attachment112143.51
fixed11225910.5
local11225910.5
multiple_backgrounds1123.6910.51.3

We use cookies to improve your experience. Learn more in our Privacy policy.

×