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 backgroundColor Property</h2> <button type="button" onclick="myFunction()">Set background color</button> <script> function myFunction() { document.body.style.backgroundColor = "red"; } </script> </body> </html>