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

Save as Private