The Blue Cup's pages now have a header with navigation, a shared footer and their content organised into section, article and aside. But a key piece is missing: nothing indicates where the main content of each page begins and ends, the content that makes it different from the others. That is the job of the main element. In this lesson you will study it together with another very useful pair, figure and figcaption, which are used to present illustrative content (a photo, a video, a table, a code fragment or a quotation) together with its caption. You will learn what goes inside main and what stays outside, why there can only be one visible, when an image deserves a figure and when a plain img is enough, and how to express a quotation with its author. By the end, every page will have its main, the gallery will have photos with captions and the reviews on the home page will be properly attributed quotations.

Contents

  1. main: the main content of the page
  2. What goes inside main and what doesn't
  3. A preview: the "Skip to content" link
  4. figure and figcaption: illustrative content with its caption
  5. What can go in a figure
  6. figure versus a plain img
  7. Project: main on every page, the gallery and the reviews

main: the Main Content of the Page

The main element represents the main content of the document: what is unique to that page and is its reason for existing. Everything that is repeated across several pages (header, menu, footer) stays outside.

<body>
  <header>
    <!-- logo and menu: repeated on every page -->
  </header>

  <main>
    <h1>Our menu</h1>
    <!-- content specific to this page -->
  </main>

  <footer>
    <!-- contact, privacy, ©: repeated on every page -->
  </footer>
</body>
  • main is a block element with no special styles: the page looks the same with it as without it.
  • It creates the main region (main content), which screen readers let users reach directly with a shortcut. It is probably the most-used shortcut of all: "take me to what matters".
  • Search engines and browser reading modes use it as a clue to where the valuable content is.

One Visible per Page

The fundamental rule is: there can only be one visible main in each document. It makes sense: if there were two, which would be the main one?

Rule Detail
A single visible main There can be others in the code if they are hidden with the hidden attribute (for example, in applications that show one "view" or another), but only one visible at a time
It can't be inside article, aside, header, footer or nav The main content can't be part of a complement, a header or a footer
Its natural place is as a child of the body It can also be inside a div (for example, a layout container)
It isn't compulsory, but it is highly recommended Every page with content should have one
<!-- Incorrect: main inside an article, and two visible main elements -->
<article>
  <main>…</main>
</article>
<main>…</main>

<!-- Correct: a single main, child of the body -->
<main>
  <article>…</article>
</main>

What Goes Inside main and What Doesn't

The test is simple: is this content specific to this page, or is it repeated on every page?

Content Inside main? Reason
The page's h1 Yes It is the title of the main content
The page's section and article elements Yes They are its own content
An aside related to the content of the page (the offer on the home page, the newsletter on the news page) Yes It complements the content of this page
A search box or a form specific to the page Yes It is part of the content
The header with the logo and the main menu No It is repeated across the whole site
The footer with contact details, privacy and copyright No It is repeated across the whole site
An aside repeated across the whole site (for example, a global sidebar) No It isn't specific to the page
graph TD
    BODY["body"] --> H["header<br>(repeated)"]
    BODY --> M["main<br>(specific to the page)"]
    BODY --> F["footer<br>(repeated)"]
    M --> H1["h1"]
    M --> S["section / article"]
    M --> A["page aside"]

A practical hint: if something doesn't change when you move to another page, it probably doesn't go in main.

A Preview: the "Skip to Content" Link

A person who navigates using only the keyboard moves from link to link with the Tab key. At The Blue Cup, before reaching the content they would have to go through the logo and the six menu links every time. That is why many sites include, as the first element of the body, a link that jumps straight to the main content:

<body>
  <a href="#content" class="skip-link">Skip to content</a>
  <header>…</header>
  <main id="content">…</main>
</body>
  • It is a link to an anchor, like the ones you created in Special Links: Anchors, Email, Phone and Downloads.
  • The target is the main, which needs an id.
  • It is usually hidden visually and only appears when it receives keyboard focus (that is done with CSS).

Don't add it yet: you will implement it in full, with its CSS, in Web Accessibility Basics. What you will do in this lesson is get id="content" ready on the main of each page.

figure and figcaption: Illustrative Content with Its Caption

The figure element represents self-contained content (an image, a diagram, a video, a code fragment…), usually with a caption (figcaption), which the main text refers to but which could be moved elsewhere (to a side panel, to an appendix) without breaking the flow of reading. It is the same as the "figures" in a textbook: "Figure 3: The front of the premises".

<figure>
  <img src="img/storefront.jpg" alt="The Blue Cup's storefront with its blue awning and a terrace with four tables" width="800" height="600">
  <figcaption>Our premises at 12 Example Street, open since 2026.</figcaption>
</figure>

Let's analyse it:

  • figure wraps the image and its caption and turns them into a unit. A screen reader announces "figure" and associates the caption with the image.
  • figcaption is the figure's caption. There can only be one per figure, and it must be the first or last child (above or below the content).
  • The image keeps its alt: the figcaption doesn't replace it.
  • By default, the browser applies a margin on both sides of a figure (which is why it appears slightly indented). You will be able to adjust it with CSS in Module 8.

alt Versus figcaption

They are two different texts with different jobs:

alt figcaption
Who sees it? Only people who don't see the image (screen reader, image that doesn't load) Everyone
What does it say? What is in the image, so as to replace it Additional information: context, author, date, place
Example "The Blue Cup's storefront with its blue awning and a terrace with four tables" "Our premises at 12 Example Street, open since 2026."

Don't copy the same text into both: a screen reader user would hear it twice. If the caption already describes the image completely, the alt can be shorter, but it must never be missing.

What Can Go in a figure

Although it is most often used with images, figure works for any illustrative content:

Several Images with a Shared Caption

<figure>
  <img src="img/dough-before.webp" alt="Freshly kneaded bread dough in a bowl" width="300" height="300">
  <img src="img/dough-after.webp" alt="The same dough, twice the size after proving" width="300" height="300">
  <figcaption>The dough before and after 12 hours of fermentation.</figcaption>
</figure>

A Video

<figure>
  <video controls width="640" height="360" poster="img/intro-poster.jpg">
    <!-- sources and track, as in Embedding Videos -->
  </video>
  <figcaption>A day in The Blue Cup's bakery (1 minute, with subtitles).</figcaption>
</figure>

A Code Fragment

<figure>
  <pre><code>&lt;nav aria-label="Main menu"&gt;…&lt;/nav&gt;</code></pre>
  <figcaption>Example 1: The Blue Cup's main menu.</figcaption>
</figure>

(Remember from Block Quotes and Preformatted Text that < and > are written as &lt; and &gt; inside pre.)

A Table

A table already has its own title, caption, which you learnt about in Accessible Tables: caption, scope and headers. That is why you don't normally need figure for a table. If for some reason you wrap it in a figure (for example, to give it a caption with the source of the data), use figcaption or caption, but not both with the same text.

A Quotation with Its Attribution

This is a very practical use. In Block Quotes and Preformatted Text you learnt that the attribution (who said it) does not go inside the blockquote, because it isn't part of what is being quoted. But you left it in a separate paragraph, with nothing to link it to the quotation. figure solves that relationship:

<figure>
  <blockquote cite="https://reviews.example/the-blue-cup">
    <p>The best croissant in the neighbourhood, and the coffee is always spot on.</p>
  </blockquote>
  <figcaption>Marta G., regular customer</figcaption>
</figure>
  • The blockquote contains only what is quoted.
  • The figcaption contains the attribution.
  • The figure brings them together: it is now clear, to machines as well, that this attribution belongs to that quotation.
Content Main element With figure?
Photo with a caption img Yes
Several photos with a shared caption img (several) Yes
Video with a description video Yes, if it has a caption
Numbered or explained code fragment pre + code Yes
Table table with caption Usually not
Quotation with its author blockquote Yes

figure Versus a Plain img

Not every image should go in a figure. The key question is: is the image a self-contained illustration, with or without a caption, that could be moved without breaking the text?

Image figure? Reason
Photo of the storefront in the gallery, with a caption Yes A self-contained illustration with a caption
Product photos in the gallery, with their names Yes Each one is an illustration with a caption
The linked logo in the header No It is a navigation link, not an illustration
The decorative divider bean-divider.svg No It is decoration (alt=""): it has nothing to illustrate
A small icon within a sentence No It is part of the text
An image that is an essential part of a step-by-step guide and can't be moved Usually not It isn't self-contained: the text depends on its position

And one nuance: a figure doesn't have to have a figcaption. You can use it without a caption if the content is a self-contained illustration; but in practice, if there is no caption, a plain img is usually enough.

Project: main on Every Page, the Gallery and the Reviews

  1. main on Every Page

On every page of the site (the six in the menu and privacy.html), wrap everything between the header and the footer in a main with id="content". The skeleton of index.html now looks like this:

  <body>
    <header>
      <p class="logo"><!-- linked logo --></p>
      <nav aria-label="Main menu"><!-- ul.menu --></nav>
    </header>

    <main id="content">
      <section class="welcome"><!-- h1 + introduction --></section>
      <section id="bakery"><!-- … --></section>
      <aside class="featured" id="offer"><!-- … --></aside>
      <section id="book"><!-- … --></section>
      <section id="opening-hours"><!-- … --></section>
      <section id="reviews"><!-- … --></section>
    </main>

    <footer><!-- contact, short opening hours, privacy, © --></footer>
  </body>
  • The h1 of each page stays inside the main: it is the title of the main content.
  • In news.html, the search box, the article elements and the newsletter aside go inside the main: they are all specific to that page.
  • In bookings.html and contact.html, the forms go inside the main.
  • id="content" is ready for the "Skip to content" link.

  1. gallery.html: Photos with Captions

In the "Our premises" block, wrap the storefront photo in a figure with its caption (keep the alt you already had if you prefer it to the one in this example):

      <section id="premises">
        <h2>Our premises</h2>
        <figure>
          <img src="img/storefront.jpg" alt="The Blue Cup's storefront with its blue awning and a terrace with four tables" width="800" height="600">
          <figcaption>Our premises at 12 Example Street, Fictional Town.</figcaption>
        </figure>
      </section>

In "From our bakery to your table", each item in the ul.product-gallery list now contains a figure with the product's name and price as its caption:

      <section id="products">
        <h2>From our bakery to your table</h2>
        <ul class="product-gallery">
          <li>
            <figure>
              <img src="img/croissant.webp" alt="Golden, flaky croissant on a white plate" width="400" height="400">
              <figcaption>Butter croissant · €2.40</figcaption>
            </figure>
          </li>
          <li>
            <figure>
              <img src="img/lemon-cake.webp" alt="Slice of lemon sponge cake with white icing" width="400" height="400">
              <figcaption>Lemon sponge cake · €2.20</figcaption>
            </figure>
          </li>
          <li>
            <figure>
              <img src="img/sourdough.webp" alt="Sourdough loaf with a golden-brown crust" width="400" height="400">
              <figcaption>Sourdough bread · €3.00</figcaption>
            </figure>
          </li>
        </ul>
      </section>
  • The list stays: it is still a set of products, and a screen reader will announce "list, 3 items".
  • Each li contains a figure: the list says "there are three", the figure says "this image with this caption".
  • The alt describes the photo; the figcaption gives the name and price, which can't be seen in the image. They don't repeat each other.
  • The prices match the table in menu.html. If you change a price, remember to update it in both places.
  • The decorative divider does not become a figure.

  1. index.html: Reviews as Attributed Quotations

In the #reviews section, each div.review becomes a figure.review, and the p.author paragraph becomes its figcaption:

      <section id="reviews">
        <h2>What our customers say</h2>
        <figure class="review">
          <blockquote cite="https://reviews.example/the-blue-cup">
            <p>The best croissant in the neighbourhood, and the coffee is always spot on. I don't have breakfast anywhere else now.</p>
          </blockquote>
          <figcaption>— Marta G., regular customer</figcaption>
        </figure>
        <figure class="review">
          <blockquote>
            <p>I did the sourdough bread-making workshop and I'm definitely coming back. They explain everything very patiently.</p>
          </blockquote>
          <figcaption>— Andrew P., workshop participant</figcaption>
        </figure>
        <!-- links to the "Neighbourhood Cafés 2026" guide and to the reviews website, unchanged -->
      </section>
  • The review class is kept (it will be used to style the reviews as cards) and the author class is no longer needed: the CSS will be able to select figcaption.
  • What was announced in Block and Inline Elements: div and span has come true: the div.review was a stopgap until you met figure.
  • Why figure and not article? Both options can be defended. A long review, with a title, a rating and a date, would be an article. For a short quotation with its author, figure + blockquote + figcaption is the most precise structure.

  1. Checking It

  1. Open all the pages with Live Server. The gallery and the reviews now appear slightly indented: that is the default margin of figure. You will adjust it in Module 8.
  2. In the DevTools accessibility tree, check that each page has exactly one main region.
  3. Type index.html#content into the address bar: the page will jump to the start of the main content, just after the menu.

Common Mistakes and Tips

  • Putting the menu or the footer inside main. Whatever is repeated on every page goes outside.
  • Two visible main elements on the same page. Only one.
  • Putting main inside an article, aside, header, footer or nav. It isn't allowed.
  • Using figcaption outside a figure or placing it in the middle of the content: it must be the first or last child of its figure.
  • Duplicating the alt text in the figcaption. Each has its own job.
  • Removing the alt because there is already a figcaption. The alt is still required.
  • Putting the attribution inside the blockquote. It goes in the figcaption.
  • Wrapping every image in a figure. Logos, icons and ornaments aren't figures.
  • Tip: a good caption answers what the image can't tell on its own: who, where, when, how much it costs.

Exercises

Exercise 1. In gallery.html, wrap the introductory video in a figure with a caption stating what it shows, its approximate length (1 minute) and that it has subtitles. What do you do with the descriptive paragraph that was already above the video?

Exercise 2. This code has four mistakes. Find them and correct them:

<body>
  <main>
    <header>
      <nav><!-- menu --></nav>
    </header>
    <h1>Gallery</h1>
    <figure>
      <figcaption>Cup of cappuccino</figcaption>
      <img src="img/cappuccino.webp" width="400" height="400">
      <figcaption>Cappuccino · €2.20</figcaption>
    </figure>
  </main>
  <main>
    <p>More photos coming soon.</p>
  </main>
</body>

Exercise 3. In news.html, the workshop news item includes the head baker's quotation with q inside a paragraph. Add a featured block quotation to that news item: "Sourdough won't be rushed", attributed to "Carmen, head baker at The Blue Cup", using the semantic structure you have learnt. Why does it make no sense to use the blockquote's cite attribute here?

Solutions

Solution 1.

      <section id="video">
        <h2>Get to know The Blue Cup on video</h2>
        <figure>
          <video controls width="640" height="360" poster="img/intro-poster.jpg">
            <!-- webm source, mp4 source and subtitle track, unchanged -->
          </video>
          <figcaption>A day at The Blue Cup, from the bakery to the counter (1 minute, with English subtitles).</figcaption>
        </figure>
      </section>

The descriptive paragraph before the video can be kept if it provides different information (for example, an invitation to watch it), or turned into the figcaption if it said the same thing. What you must avoid is repeating the same information in the paragraph and in the caption.

Solution 2.

  1. The header with the menu is inside the main: it must go outside, before the main.
  2. There are two figcaption elements in the same figure: only one is allowed. Keep the one that provides information (name and price).
  3. The image has no alt.
  4. There are two visible main elements. The "More photos coming soon" notice is part of the gallery's content: it goes inside the single main.
<body>
  <header>
    <nav><!-- menu --></nav>
  </header>
  <main>
    <h1>Gallery</h1>
    <figure>
      <img src="img/cappuccino.webp" alt="Cup of cappuccino with leaf-shaped foam" width="400" height="400">
      <figcaption>Cappuccino · €2.20</figcaption>
    </figure>
    <p>More photos coming soon.</p>
  </main>
</body>

Solution 3. Inside the workshop article, after the paragraph with the short quotation (or instead of it, if you don't want to repeat the sentence):

      <figure>
        <blockquote>
          <p>Sourdough won't be rushed.</p>
        </blockquote>
        <figcaption>Carmen, head baker at The Blue Cup</figcaption>
      </figure>

The blockquote's cite attribute is used to give the URL of the source of the quotation. Here the sentence was said in the interview recorded by the café itself; there is no external page it comes from. If you wanted to, you could point to the transcript on the same page (cite="#bread-workshop"), but it isn't necessary. Remember that the cite attribute isn't displayed; the visible attribution is the one in the figcaption.

Conclusion

In this lesson you have completed the skeleton of the pages: main marks the main content, the content specific to each page; there can only be one visible, never inside a header, a footer, an article or a complement, and it creates the region that screen reader and keyboard users jump to in order to get to what matters (with id="content" ready for the "Skip to content" link in Module 10). You have also mastered figure and figcaption, the pair that links illustrative content (images, videos, code, tables or quotations) with its caption, and you can tell the alt, which replaces the image, from the figcaption, which complements it, and know when a plain img is enough. Every page of The Blue Cup now follows the header – main – footer outline, the gallery shows products with their names and prices, and the reviews are attributed quotations. There are still some pieces of data that machines don't understand yet (the dates of the news items, the address in the footer) and content it would be useful to be able to collapse or display in a dialog box. You will solve this in the last lesson of the module, Other Semantic Elements: time, address, details and dialog.

HTML Course

Module 1: Introduction to HTML

Module 2: Text Formatting in HTML

Module 3: Links and Media in HTML

Module 4: Tables in HTML

Module 5: Forms in HTML

Module 6: HTML5 Semantic Elements

Module 7: Advanced HTML Techniques

Module 8: Integrating HTML and CSS

Module 9: Responsive Web Design

Module 10: Best Practices and Accessibility

Module 11: Project: Building a Complete Website

© Copyright 2026. All rights reserved