HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> body{ background-image: url("apple.png"); background-repeat: no-repeat; } </style> </head> <body> <h1>CSS background-position Property</h1> <p>CSS background-position to 'center'</p> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("body")[0]; function myFunction(){ x.style.backgroundPosition = "25px 100px"; } </script> <p><strong>Note</strong>: Click on the button to set the background-position to '25px 100px'</p> </body> </html>
OUTPUT
×

Save as Private