Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<style>
div {
  background-image: url('img_tree.png');
  background-repeat: no-repeat;
  width: 400px;
  height: 400px;
  border: 1px solid #000000;
}
</style>
<body>
<h1>HTML Style Object</h1>
<h2>The backgroundPosition Property</h2>
<button type="button" onclick="myFunction()">Position background image</button>
<br>
<div id="myDiv">
</div>
<script>
function myFunction() {
  document.getElementById("myDiv").style.backgroundPosition = "200px 40px";  
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_style_backgroundposition3 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:48 GMT -->
</html>