CSS - background-attachment


background-attachment determines the tiling context and scroll state of a background image.

Possible Values:

  • scroll: A background image set to scroll will scroll along with the rest of the document.
  • fixed: A background image set to fixed will remain locked in place while the rest of the document scrolls.

Applies to:

All the HTML elements.

DOM Syntax:

object.style.backgroundAttachment= scroll | fixed;


<p style="background-image:url(images/pattern1.gif);
 background-attachment:scroll;">  This parapgraph has scrolling background image.  </p>  

Spacer Bottom Left Corner ImageBottom Right Corner Image
Valid XHTML 1.0 Strict  Valid CSS! Check the accessibility of this site according to U.S. Section 508