liveBook · Manning

Main

As explained in Web Design Playground

The primary content area of a page that carries the central information or purpose of the page.

The <main> element marks the page’s central, page-specific content—the part that changes when you visit a different page. It usually sits after the header and navigation, while shared elements such as the footer stay outside it. section 11.6

Think of <main> as the stage for the page’s most important act. On a personal page, it can hold body text about you; in a gallery, it can hold the thumbnails visitors came to see. section 5.26 section 15.7

A useful way to plan the element is to ask:

  • What content is unique to this page? Put that content in <main>. section 11.6
  • Does the page need multiple regions? Place elements such as <article> and <aside> inside <main>. section 12.17
  • Is the content a gallery? Make each thumbnail link to its full-size photo, then let the thumbnails wrap inside <main>. section 15.28

A page’s central stage

<body> can contain a shared header and navigation, followed by <main>. Inside it, an article can carry the primary content and an aside can provide a sidebar. With flexbox, <main> can arrange those regions and expand to fill available vertical space. section 11.6 section 12.17

<main>
    <article>
        <h2>Article Title</h2>
        <p>Article paragraph 1</p>
        <p>Article paragraph 2</p>
    </article>
    <aside>
        <h3>Sidebar Title</h3>
        <p>Sidebar paragraph</p>
    </aside>
</main>

Use this compact structure to see how <main> groups an article and sidebar while keeping the page regions easy to identify. section 12.17

How Web Design Playground covers it

How deep it goes
Defines semantic placement, nesting, and flexbox behavior, while stopping short of deeper accessibility guidance.
Examples
Uses personal-page text, article-and-sidebar layouts, and photo galleries containing linked, wrapping thumbnails.
What it assumes
Assumes basic HTML page structure and introduces <main> alongside header, nav, article, aside, and footer.
What you can do after
Build it from scratch by placing unique content in <main> and arranging its regions with semantic HTML and flexbox.
How it connects
Connects header, nav, footer, article, aside, body element, and flexbox into page structures.

Also explained in

Compare how 3 books explain main →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground. The section links point to the parts of the book it draws on.