<!DOCTYPE html>
<html>
<head>
<style>
#myDIV {
    border: 1px solid black;
    width: 300px;
    height: 150px;
    background: url('smiley.gif') no-repeat;
}

</style>
</head>
<body>

<p>Click the "Try it" button to set the background-position property of the DIV element to "center":</p>

<button onclick="myFunction()">Try it</button>

<div id="myDIV">
  <h1>Hello</h1>
</div>

<script>
function myFunction() {
    document.getElementById("myDIV").style.backgroundPosition = "center";
}
</script>

</body>
</html>