HTML Guides for background-attachment
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
The background-attachment property only accepts scroll, fixed and local, so the validator reports any other value, such as static, none or auto.
static is the default of position, not of background-attachment. The default here is scroll, which ties the background to the element itself: it moves with the page, but not with content that scrolls inside the element. fixed pins the background to the viewport, and local makes it scroll along with the element's own content.
Browsers ignore the invalid declaration, so the background falls back to scroll, or to whatever an earlier rule set. If you wrote static to cancel a fixed background, the background stays fixed until you change the value to scroll.
With several background layers, the property takes a comma-separated list such as scroll, fixed. One bad keyword in the list is enough to trigger the error, and the browser then drops the whole declaration. In the background shorthand the same mistake produces a different message: “background”: “static” is not a “background-color” value.
Invalid example
.hero {
background-image: url("hero.jpg");
background-attachment: static;
}
Valid example
.hero {
background-image: url("hero.jpg");
background-attachment: scroll;
}
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries