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 backgroundImage Property</h2> <button type="button" onclick="myFunction()">Set background image</button> <script> function myFunction() { document.body.style.backgroundColor = "#f3f3f3"; document.body.style.backgroundImage = "url('img_tree.png')"; } </script> </body> </html>