Coding Lesson

← All lessons

HTML: Structure

Headings and paragraphs

Lesson 3 of 18 · About 20 minutes

Your goal: Organise content into sections.

Learn

A reader should be able to scan your headings and understand the page before reading every sentence. You will turn the aquatic-plant starter into two useful sections about your hobby, using heading levels for meaning and paragraphs for separate ideas.

Walkthrough: why the code works

  1. Find the existing outline

    The starter contains one h1, followed by two h2 elements. The h1 names the whole topic. Floating Plants and Submerged Plants are equally important sections, so both use h2. The p after each section heading supplies its explanation.

  2. Choose a topic and two reader questions

    Replace the main topic with your hobby. For gardening, Equipment and Getting started answer two different beginner questions. Write the headings before the paragraphs. Keep one main heading for this small page; do not choose h3 merely because its default text looks smaller.

    <h1>Gardening</h1>
    <h2>Equipment</h2>
    <p>I use a pot, soil and a watering can.</p>
    <h2>Getting started</h2>
    <p>Fill the pot with soil and plant your seeds.</p>
  3. Give each idea a paragraph

    Put each paragraph inside its own opening p and closing /p tags. Pressing Enter in the source helps you read the code but does not create another paragraph in the browser. If you add advice about watering, give that separate idea another p below the first planting paragraph.

  4. Keep structure separate from decoration

    Heading elements tell readers and assistive technology how content is organised. Bold text alone does not create a heading. Later CSS lessons will change font size and colour without changing the levels. If Getting started needs a subsection, an h3 can sit beneath that h2.

  5. Check by reading only the headings

    Run the code and read the three headings in order. Do they describe the page clearly? Then read the paragraph below each h2. Move a paragraph if it answers the other section’s question. Download the result so you can add lists and links in the next lesson.

Expected results

  • Your hobby appears as the main heading, with two section headings below it.

  • Each section has a relevant paragraph; adding another p creates a separate block of text.

  • Changing the text does not alter the heading levels or the order of the sections.

Common mistakes and how to fix them

  • Everything is one large heading: Look for a missing closing heading tag. Close h1 before starting the next element.

  • A heading level was chosen for its size: Restore the logical level. Change appearance with CSS when you reach the styling lessons.

  • Two ideas run together: Use separate p elements. Extra spaces or newlines in the source normally collapse when displayed.

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>Topic: Aquatic Plants</h1>
    <h2>Floating Plants</h2>
    <p>These plants float on water.</p>
    <h2>Submerged Plants</h2>
    <p>These plants grow below the surface.</p>
  </body>
</html>

Your challenge

Change this to your hobby. Keep one h1 and two h2 headings; add a paragraph to each section.

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

Try sections called Equipment and Getting started.

Show a sample answer

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

<h1>Gardening</h1>
<h2>Equipment</h2>
<p>I use a watering can.</p>
<h2>Getting started</h2>
<p>Choose a pot and plant some seeds.</p>

Check your work

There is one main heading, two section headings and a paragraph in each section.

Completion is your own check, not an automatic grade.