loading

Background Attachment

CSS background-attachment

Whether the background picture should scroll or remain fixed (not scroll with the rest of the page) is specified by the background-attachment property:

Example

Specify that the background image should be fixed:

				
					body {
  background-image: url("img_tree.png");
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: fixed;
}
				
			

Example

Specify that the background image should scroll with the rest of the page:

				
					body {
  background-image: url("img_tree.png");
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: scroll;
}
				
			

The CSS Background Attachment Property

Property Description
background-attachment Sets whether a background image is fixed or scrolls with the rest of the page
Share this Doc

Background Attachment

Or copy link

Explore Topic