coderef

background-attachmentLimited availability

The background-attachment CSS property sets whether an element's background image or gradient moves as the element scrolls.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1+Supportedsince Dec 11, 2008
Current: 155
Edge
12+Supportedsince Jul 29, 2015
Current: 154
Firefox
1–24Not supported
25+Supportedsince Oct 29, 2013
Current: 157
Safari
1–15.3Not supported
15.4+Supportedsince Mar 14, 2022
Current: 27
MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155
Firefox Android
4–24Not supported
25+Supportedsince Oct 29, 2013
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: background-attachment.

Feature detection

CSS · check before using
@supports (background-attachment: initial) {
  /* styles that rely on background-attachment */
}

/* or in JavaScript */
if (CSS.supports("background-attachment", "initial")) {
  // use it
}

Sub-features

Support for each part of the feature (5). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
background-attachment112111843.2
background-attachment.fixed112215.4184✕
background-attachment.local1122515.4182515.4
background-attachment.multiple_backgrounds1123.61.31843.2
background-attachment.scroll112111843.2