Tutorials

CSS 'background-attachment' Property Explained

  • Published
  • 1 min read
  • CSS
  • HTML
  • Web Design
CSS 'background-attachment' Property
In this article
  1. CSS 'background-attachment' Property Example
  2. Browser Support For 'background-attachment' Property
  3. CSS Syntax of the 'background-attachment' Property
  4. Usage of the 'background-attachment' Property
  5. Property Values of the 'background-attachment' Property

Corrected . The browser-support table was rebuilt from MDN browser-compat-data (unprefixed support, desktop browsers), checked 3 October 2026. Editorial approval is still pending.

The CSS 'background-attachment' property specifies whether a background image should scroll with the content or be fixed about the viewport. This property can be used to create various effects, such as a parallax scrolling effect or ensuring that a background image remains static as the user scrolls through a webpage.

CSS 'background-attachment' Property Example

See the Pen CSS 'background-attachment' Property by Webzstore (@webzstore) on CodePen.

The 'background-attachment' property offers creative control over how background images interact with page scrolling, allowing for diverse design strategies that can enhance a website's aesthetic and user experience.

Browser Support For 'background-attachment' Property

Unprefixed support for the background-attachment property (selected supported implementation, desktop browsers)
BrowserVersionReleased
Chrome1Dec 2008
Edge12Jul 2015
Firefox1Nov 2004
Safari1Jun 2003
Opera3.5Nov 1998

Source: MDN browser-compat-data 8.1.4, checked 3 October 2026. Prefixed support and implementations that were later removed are not counted, and some browsers list partial support or extra values. See the MDN reference for background-attachment for the full compatibility details, including mobile browsers.

CSS Syntax of the 'background-attachment' Property

background-attachment: scroll | fixed | local | initial | inherit;

Usage of the 'background-attachment' Property

Use 'background-attachment' to control the scrolling behavior of background images. It's beneficial for adding visual depth to a webpage or creating specific visual effects that enhance the user's experience. For instance, a fixed background image can create a sense of immersion, while a scrollable background can maintain context as content moves.

Property Values of the 'background-attachment' Property

  • Scroll: The default value. The background image scrolls with the rest of the page.
  • Fixed: The background image is fixed with regard to the viewport, creating a parallax effect as the user scrolls.
  • Local: The background image scrolls with the element's contents.
  • Initial: Resets the property to its default value (scroll).
  • Inherit: Inherits this property from its parent element.

Share this article

Written by

Webzstore Team

Webzstore has helped businesses since 2010. Today, we bring websites, digital marketing and enquiry follow-up into practical plans built around the work each business needs.

Related services

Talk about your website or marketing

Book a Free 30-Minute Call

More tutorials

All tutorials

Privacy choices

Choose what this website may load. Your choice is saved on this device for up to 180 days. Privacy Policy

Turning a choice off stops further use of that optional service on this site. It does not take back information already sent, and we cannot delete cookies that other services set in your browser.