W3
Teach
HTML
CSS
JavaScript
HTML+CSS+JS
Run ยป
Editor
HTML
CSS
JS
<!DOCTYPE html> <html> <head> <style> body { font-family: Arial, sans-serif; background: #f0f8ff; text-align: center; padding: 40px; } h1 { color: #04AA6D; } .box { background: white; border-radius: 8px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); display: inline-block; margin-top: 20px; } button { background: #04AA6D; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-size: 16px; } button:hover { background: #028b58; } </style> </head> <body> <h1>Hello, World!</h1> <div class="box"> <p id="msg">Click the button below!</p> <button onclick="changeText()">Click Me</button> </div> <script> function changeText() { document.getElementById("msg").innerHTML = "You clicked the button! ๐"; document.getElementById("msg").style.color = "#04AA6D"; } </script> </body> </html>
Result