Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body style="background: #f3f3f3 url('img_tree.png') no-repeat fixed right top;">
<h1>HTML Style Object</h1>
<h2>The backgroundAttachment Property</h2>
<p><b>Tip:</b> Try to to resize the window if the scrollbar is not available.</p>
<p>Click the button to toggle between scroll and fixed position.</p>
<p><b>Tip:</b> Scroll the page before and after you have clicked the button.</p>
<button id="toggle" onclick="myFunction();">Set image to scroll</button>
 
<p>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
Some text to enable scrolling.
<br><br><br><br>
</p>
<script>
function myFunction() {
  let x = document.body.style.backgroundAttachment;
  document.getElementById("toggle").innerHTML=(x=="scroll")? "Set bg image to scroll!":"Set bg image to fixed!";