<!DOCTYPE html> <html> <head> <style> .mystyle { margin: 20px; width: 300px; height: 50px; background-color: coral; color: white; font-size: 25px; } </style> </head> <body> <p>Click the button to add the "mystyle" class to DIV.</p> <button onclick="myFunction()">Try it</button> <div id="myDIV"> I am a DIV element </div> <br> <script> function myFunction() { document.getElementById("myDIV").classList.add("mystyle"); } </script> </body> </html>