Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>HTML Style Object</h1> <h2>The backgroundPosition Property</h2> <p>The background position is:</p> <p id="demo"></p> <div id="myDiv" style="background:url('img_tree.png') no-repeat center;height:500px;width:500px;border:1px solid black;"> </div> <script> let pos = document.getElementById("myDiv").style.backgroundPosition; document.getElementById("demo").innerHTML = pos; </script> </body> </html>