background stays in place css code example
Example 1: html static background
body {
background-image: url("img_tree.gif");
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
Example 2: How to make background fixed while scrolling
On-scroll fixed background