index.html
setup.css
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="/assets/styles/reset.css" rel="stylesheet"> <link href="setup.css" rel="stylesheet"> </head> <body> <button id="example">Click here!</button> <script> // Set up a variable for our button! let button = document.querySelector('#example'); // Any CSS selector. button.onclick = () => { // Attach the click event. alert('The button was clicked!'); // Pop an alert! }; </script> </body> </html>
html, body { height: 100%; } body { --base: 20px; align-items: center; display: flex; font-family: sans-serif; justify-content: center; padding: var(--base); } button { background-color: deepskyblue; border-radius: calc(var(--base) / 2); cursor: pointer; /* Show the Mickey-Mouse hand! */ padding: calc(var(--base) / 2); }