CSS background-attachment property

Usage

Determines whether the background image scrolls with the browser window or stays fixed within it.

Values

  • scroll - the background will move with the rest of the page (default)
  • fixed - the background remains fixed within the browser window

Example

Code:

body {
  background-image: url(background.jpg);
  background-attachment: fixed;
}