<h2><code>scroll (default)</code></h2>
<div class="scroll"><div class="expand"></div></div>

<h2><code>fixed</code></h2>
<div class="fixed"><div class="expand"></div></div>

<h2><code>local</code></h2>
<div class="local"><div class="expand"></div></div>

<br class="extra-space">
@import "compass/css3";

h2 {
  text-align: center;
  margin-top: 48px;
}

div {
  height: 200px;
  width: 50%;
  max-width: 600px;
  margin: 32px auto;
  overflow-x: hidden;
  overflow-y: scroll;
}

.scroll {
  background: url('https://assets.codepen.io/2065/manja-vitolic-gKXKBY-C-Dk-unsplash_1.jpg');
  background-attachment: scroll;
}

.fixed {
  background: url('https://assets.codepen.io/2065/manja-vitolic-gKXKBY-C-Dk-unsplash_1.jpg');
  background-attachment: fixed;
}

.local {
  background: url('https://assets.codepen.io/2065/manja-vitolic-gKXKBY-C-Dk-unsplash_1.jpg');
  background-attachment: local;
}

.expand {
  height: 400px;
  width: 100%;
}

.extra-space {
  margin-bottom: 50px;
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js