background fixed code example

Example 1: how to make fixed background image in css

body {
  background-image: url("img_tree.gif");
  background-repeat: no-repeat;
  background-attachment: fixed;
}

Example 2: html static background

body {
  background-image: url("img_tree.gif");
  
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  
  background-size: cover;
}

Example 3: css background image follow scroll

background-attachment: scroll;
background-attachment: fixed;
background-attachment: local;

Tags:

Css Example