HomeReferencesCSS Properties

CSS Property: background-attachment

Specifies the attachment of the background image to the containing element. For example, if a background image is applied to a page normally the image will scroll with the rest of the page, but if the property is set to fixed then the image will stay in the same position as the user scrolls the page up and down.

HTML Dog, The Book HTML Dog book cover

HTML Dog is hosted by Titan Internet

Possible Values

  • inherit
  • scroll (default) - the background image will scroll with the rest of the content.
  • fixed - the background image will remain stationary as the rest of the content is scolled.

Example


body { background-attachment: fixed; }