background-attachment CSS property defines whether the background image scrolls with the document, or remains fixed to the viewing area.
The following table summarizes the usages context and the version history of this property
|Applies to:||All elements|
|Animatable:||No. See animatable properties.|
|Version:||CSS 1, 2, 3|
The syntax of the property is given with:
The example below shows the
background-attachment property in action.
ExampleTry this code »
The following table describes the values of this property.
||The default value. The background image is fixed with regard to the element itself and scroll within the viewport along with its containing element.|
||The background image is fixed with regard to the viewport and doesn't move with the element.|
||The background image stays fixed with regard to the element's contents: if the element has a scrolling mechanism, the background scrolls with the element's contents.|
||Sets this property to its default value.|
||If specified, the associated element takes the computed value of its parent element
background-attachment property is supported in all major modern browsers.