Lesson 4: Your First Interactive Example

Now let’s combine everything to create a mini webpage:

Code Example:

<!DOCTYPE html>
<html>
  <head>
    <title>My First Website</title>
    <style>
      body {
        background-color: lightgray;
        font-family: Arial, sans-serif;
        text-align: center;
      }
      h1 {
        color: darkgreen;
      }
      button {
        padding: 10px 20px;
        background-color: green;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
      }
      button:hover {
        background-color: darkgreen;
      }
    </style>
  </head>
  <body>
    <h1>Welcome to My Interactive Website</h1>
    <p>Click the button below to see some magic!</p>
    <button onclick="alert('You clicked the button!')">Click Me</button>
  </body>
</html>

How to View Your Work:

  1. Save the file as index.html in your MyFirstWebsite folder.
  2. Open the file in your browser by double-clicking it.

You’ve just created your first interactive webpage! 🎉