← Level 1 – Builder

Lesson 4 of 12 ⏱ 25 minutes

Links and a second page

Your website stops being just one page. You'll build a second one and connect them with links.

A link (the clickable thing that takes you somewhere else) is made with the <a> tag:

<!-- A link to another page on your own website -->
<a href="lunch-menu.html">Lunch Menu</a>

<!-- A link out to somewhere else on the internet -->
<a href="https://www.si.edu">Our favorite museum's website</a>

A second page

Your website only has index.html so far. Let’s add a second page: it’s just another file in the same folder:

  1. In VS Code, create a new file. Name it based on your project, like lunch-menu.html, about-me.html, trips.html, or roster.html. Again, lowercase, no spaces or accents.

  2. Paste in the full page skeleton (the same one from lesson 1) and give it its own <title>, <h1>, and some content.

  3. Connect the pages with links: on index.html, add a link to the new page, and on the new page, add a link back: something like <a href="index.html">Back home</a>.

Your turn 💪

Create a second page and link both pages together. Make at least one link point somewhere out on the internet too.

🏫 School website: solution (lunch-menu.html)
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Lunch Menu – Riverside Elementary</title>
  </head>
  <body>
    <h1>This Week's Lunch Menu</h1>
    <ul>
      <li>Monday: tomato soup with pasta</li>
      <li>Tuesday: chicken with rice</li>
      <li>Wednesday: pancakes with syrup 🎉</li>
      <li>Thursday: beef stew with dumplings</li>
      <li>Friday: fish and potatoes</li>
    </ul>
    <p><a href="index.html">← Back to the homepage</a></p>
  </body>
</html>

And on index.html, add:

<p><a href="lunch-menu.html">Check out the lunch menu</a></p>
🙋 Personal website: solution (about-me.html)
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>More About Me – Jake</title>
  </head>
  <body>
    <h1>More About Me</h1>
    <p>I'm in 4th grade, I have a dog named Rocky, and I collect soccer cards.</p>
    <p>My favorite thing to listen to is <a href="https://www.youtube.com">music on YouTube</a>.</p>
    <p><a href="index.html">← Back home</a></p>
  </body>
</html>
🌍 Travel journal: solution (trips.html)
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>All Trips – Where We've Been</title>
  </head>
  <body>
    <h1>All Our Trips</h1>
    <ol>
      <li>The mountains – a ridge hike</li>
      <li>Greece – island hopping</li>
      <li>Washington, D.C. – museums and monuments</li>
    </ol>
    <p>We plan our routes with <a href="https://maps.google.com">Google Maps</a>.</p>
    <p><a href="index.html">← Back to the homepage</a></p>
  </body>
</html>
⚽ Club website: solution (roster.html)
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Roster – Riverside Eagles FC</title>
  </head>
  <body>
    <h1>Team Roster</h1>
    <ul>
      <li>Jake – goalkeeper (captain)</li>
      <li>Matt – defense</li>
      <li>Owen – midfield</li>
      <li>Tom – forward</li>
    </ul>
    <p>Check the league schedule at <a href="https://www.ussoccer.com">ussoccer.com</a>.</p>
    <p><a href="index.html">← Back to the homepage</a></p>
  </body>
</html>
✅

Check yourself: You click a link on the homepage → the second page opens. You click “Back” → you’re home again. Your website now has more than one page for the first time!

What to take away from this lesson