From W3C Wiki
Jump to: navigation, search


The background-attachment property specifies whether a background image is fixed with regard to the viewport or scrolls along with the containing block.


Values scroll | fixed | inherit
Initial value scroll
Applies to All elements
Inherited No

Point, Note

  • Only when the background image is specified, this property is effective.


  • scroll
    If specified, the background image scrolls with the element.

  • fixed
    If specified, the background image does not scrolls with the element.

  • inherited


Example A


 body {
   background-image: url("images/bg.png");
   background-position: bottom right;
   background-attachment: fixed;
   background-repeat: no-repeat;

CSS Reference

The CSS specification defines the background-attachment property in 14.2.1 Background properties.