<!DOCTYPE html>
<html lang="en-US">
<head>
<style>
body{
height:800px;
}
#parent{
background-image: url("ocean.jpg");
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-position: center;
height: 300px;
color: #fff;
overflow-y: scroll;
}
#child{
line-height: 4;
}
</style>
</head>
<body>
<div id="parent">
<div id="child">
<h1>CSS background-attachment Property</h1>
<p>CSS background-attachment to 'scroll'.</p>
<p>First, scroll the div</p>
<p>Some more content</p>
<p>Some more content</p>
<p>Some more content</p>
</div>
</div>
<p><strong>Note</strong>: First scroll the div and then scroll the body to see the difference between the examples in 'background-attachment'.</p> </body>
</html>