HTML5 semantic page layout — header, nav, main, article, aside and footer

Enter your site name, page heading and menu links to get a complete HTML5 page built from semantic landmarks, with a skip link, a labelled navigation, one h1 inside the article, optional sections and a sidebar, and a preview that outlines each region.

Live demo · real result from this tool

Press Generate to create a result.

Processed on your device — nothing is uploaded.

How to use the semantic layout generator

  1. Enter the Site name and the Page heading.
  2. List Navigation links (comma-separated), for example Home, PDF, Images, Developers, About. Leave it empty for no menu.
  3. Set the number of Sections in the article, from 0 to 8.
  4. Tick Sidebar (aside) if the page has related links or extra content.
  5. Set the Language code, such as en, fr or en-IN.
  6. Copy the code or download it as index.html. The Preview draws a dashed outline around each region.

What it does and when to use it

HTML5 has elements that say what each part of a page is for. header holds the logo and site navigation. nav marks a block of main links. main holds the content that is unique to this page, and there should be only one. article is a self-contained piece such as a post or a tool page, section is a headed part of it, aside holds related but separate content, and footer holds the copyright and secondary links.

Using them gives screen readers landmarks, helps search engines find the main content, and makes your CSS easier to read. This generator lays them out in the usual order with one h1 in the article and h2 headings for sections and the sidebar, so the heading outline is correct from the start.

For a head section with meta tags, favicons and social tags, start from the HTML Boilerplate Generator. To give the menu submenus and an aria-current marker, replace the nav with output from the HTML Nav Menu Generator.

How it works

The document starts with <!DOCTYPE html>, <html lang>, a UTF-8 charset, the viewport tag and a title made from “page heading | site name”. The body contains the skip link, the header with a home link and the labelled menu, main id="main" with the article and optional aside, and a footer with &copy; and the site name. All text is HTML-escaped. The preview uses extra CSS only to label the regions; that CSS is not part of the code you copy. Everything runs in your browser.

Worked examples

The default page has five menu links, two sections and a sidebar. Its landmarks start like this:

<a class="skip-link" href="#main">Skip to content</a>
<header>
  <a href="/" class="logo">ToolsRift</a>
  <nav aria-label="Main">

and continue with <main id="main">, <article>, two <section> blocks and <aside aria-label="Related">.

A minimal recipe page. Site “Asha’s Recipes”, heading “Lemon rice”, language en-IN, no menu, no sections, no sidebar. The title is <title>Lemon rice | Asha&#39;s Recipes</title>; the apostrophe is escaped. The header holds only the logo link, and the article holds only <h1>Lemon rice</h1>.

Limits and tips

  • Section headings are placeholders (“Section 1”) with … as content. Replace them with your real text.
  • Add a skip-link style before publishing, or the link shows at the top of the page.
  • Check the finished page with the HTML Validator after you fill in content.

Frequently asked questions

What are landmarks and why do they matter?
Landmarks are the page regions that header, nav, main, aside and footer create. Screen-reader users can list them and jump straight to the main content or the navigation, much as sighted users glance at a layout. A page built only from div elements has none of these shortcuts.
What is the skip link for?
It is the first link on the page and jumps to main, which has id="main". Keyboard users can then skip the whole menu on every page. Hide it off-screen with CSS and show it when it receives focus; the generated code includes the class skip-link but no CSS for it.
Why does the nav have an aria-label?
A page often has more than one nav, for example a main menu and a footer menu. A label such as "Main" lets screen readers tell them apart. The aside gets "Related" for the same reason.
When should I use section instead of div?
Use section for a thematic part of the content that has its own heading, as the generated h2 sections do. If you need a wrapper only for styling, a div is the right choice.
How are the menu link addresses chosen?
The first link goes to the home page, /. The others become a slug of their text, so Developers becomes /developers. Edit them after copying if your URLs differ.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close