Coding Lesson

← All lessons

HTML: Structure

Lists and links

Lesson 4 of 18 · About 20 minutes

Your goal: Add a list and a useful link.

Learn

Lists help visitors scan related items, while links help them reach another resource. You will add three supplies for your hobby and a link whose text explains its destination. The visible link text and its destination address are separate parts of the HTML.

Walkthrough: why the code works

  1. Read the list wrapper

    The starter has a ul containing one li. The ul groups the list; each li is an item. Add two more li elements before the closing ul so the three items belong to the same list. Use an unordered list for supplies whose order does not matter.

    <ul>
      <li>Seeds</li>
      <li>Soil</li>
      <li>A pot</li>
    </ul>
  2. Choose a list that matches the information

    If you later describe steps that must happen in order, use ol instead of ul. Keep li for the individual steps. Typing bullet characters into a paragraph may look similar, but does not express the same list structure.

  3. Separate the destination from its label

    The a element’s href contains the address. The words between the opening and closing tags form the visible label. Replace both when choosing a different resource. Use a complete HTTPS address for an external website.

    <a href="https://playcode123.com/learning-path/">Follow the beginner coding lessons</a>
  4. Make the link useful without surrounding text

    A label such as Follow the beginner coding lessons tells readers what to expect. Avoid repeating Click here for different destinations. For your hobby page, choose a resource you have checked and describe what it helps the reader do.

  5. Test from a saved page

    Run the example and check that three bullets appear. Download the HTML before testing navigation. Open the saved page, follow the link, and confirm its destination. If an embedded Sandbox preview restricts navigation, test the same downloaded HTML in a normal browser tab. Use Tab and Enter to try the link without a mouse.

Expected results

  • Three separate supplies appear as one list.

  • The link shows your descriptive label and opens the resource named in href.

  • The link can receive keyboard focus and activate with Enter in the saved page.

Common mistakes and how to fix them

  • Items appear outside the list: Keep all three li elements between the opening and closing ul tags.

  • The label changed but the destination did not: Edit href as well as the words between the a tags.

  • A web address is treated as a local filename: For this exercise include https://. A relative address such as about.html needs a matching local file.

View starter code
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>My hobby page</title>
    <style></style>
  </head>

  <body>
    <h1>My hobby</h1>
    <p>I enjoy learning something new.</p>
    <ul>
      <li>First item</li>
    </ul>
    <a href="https://playcode123.com/">Visit Playcode123</a>
  </body>
</html>

Your challenge

List three things needed for your hobby and add a useful web link.

Keep developing your hobby page: Download HTML before leaving the sandbox, then choose Open HTML file when returning to your project. Load saved draft restores only this lesson’s draft in this browser.

Practise in the sandbox
Show a hint

Add three li elements inside the ul element. Use a full https:// address for your link.

Show a sample answer

Try the challenge first. This is one possible answer or a snippet to adapt.

<ul>
  <li>Seeds</li>
  <li>Soil</li>
  <li>A pot</li>
</ul>
<a href="https://playcode123.com/">Practise making web pages</a>

Check your work

Three list items appear, and the link opens the intended page.

Completion is your own check, not an automatic grade.