Document structure: main, article, section and nav
<a href="#main-content" class="skip-link">Skip to content</a>
<header>
<nav aria-label="Main navigation">
<ul>
<li><a href="/en">Home</a></li>
<li><a href="/en/docs">Documentation</a></li>
</ul>
</nav>
</header>
<main id="main-content" tabindex="-1">
<article>
<header>
<h1>Product guide</h1>
<p>Product information</p>
</header>
<section>
<h2>Delivery terms</h2>
<p>Delivery on working days.</p>
</section>
</article>
</main>
<footer>
<p>Example company</p>
</footer>.skip-link {
position: absolute;
inset-block-start: 0.5rem;
inset-inline-start: 0.5rem;
z-index: 10;
padding: 0.75rem 1rem;
background: #ffffff;
color: #111827;
transform: translateY(calc(-100% - 1rem));
}
.skip-link:focus {
transform: none;
outline: 3px solid #2563eb;
outline-offset: 2px;
}
Use main for the primary content, article for a self-contained publication, section for a thematic part of a document (usually with a heading), and div for grouping without extra meaning. Not every group needs a section. Reserve nav for significant navigation rather than every collection of links. [1][2]
The example has one visible main containing an article. The site-level header and footer represent page landmarks; an article header is not another global banner. A skip link lets users bypass repeated navigation. tabindex="-1" makes the target focusable without inserting it into the regular Tab order. Do not hide the skip link with display: none. [2][3]
The /docs and /delivery-preference routes and image files are illustrative; connect your own resources and form handler. The CSS optionally reveals the skip link on focus.
Heading hierarchy and landmark names
<h1>Product guide</h1>
<nav aria-labelledby="contents-title">
<h2 id="contents-title">Contents</h2>
<ul>
<li><a href="#delivery">Delivery</a></li>
<li><a href="#collection">Collection</a></li>
</ul>
</nav>
<section id="delivery">
<h2>Delivery</h2>
<h3>Delivery terms</h3>
<p>Delivery on working days.</p>
</section>
<section id="collection">
<h2>Collection</h2>
<p>Collection in person</p>
</section>
Use h1 for the primary topic, h2 for major sections and h3 for their subsections. Choose the level by structure, not font size; CSS handles presentation. Screen reader users can navigate by headings, so skipping levels when nesting sections can obscure the hierarchy. [4]
When a page has two different navigation areas, distinguish their names. aria-labelledby can reference an existing visible heading instead of duplicating it. A named section can be exposed as a region landmark, but naming every section creates unnecessary navigation noise. [3]
Links, buttons and native controls
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML">
HTML documentation
</a>
<details>
<summary>Delivery details</summary>
<p>Delivery on working days.</p>
</details>
An a element with href navigates to a resource; a button performs an action. Native controls have built-in keyboard behavior and semantics. Adding role="button" to a div does not supply focus, Enter and Space activation or styling. Avoid replacing real links with JavaScript-only click targets. [5][6]
The example combines a documentation link with a native details/summary disclosure. A form submission button explicitly uses type="submit". A non-submit button inside a form should use type="button" to avoid accidental submission. Preserve a visible focus indicator. [6]
Forms: labels, groups and descriptions
<form action="/delivery-preference" method="post">
<label for="contact-email">Email</label>
<input
id="contact-email"
name="email"
type="email"
autocomplete="email"
aria-describedby="email-help"
required
/>
<p id="email-help">We will send confirmation to this address.</p>
<fieldset>
<legend>Delivery method</legend>
<label>
<input type="radio" name="delivery" value="courier" required />
Courier
</label>
<label>
<input type="radio" name="delivery" value="collection" />
Collection in person
</label>
</fieldset>
<button type="submit">Save selection</button>
</form>
Associate a visible label with its field through matching for and id values. A placeholder is not a substitute because it disappears as users type. fieldset and legend describe a related group of controls, such as delivery options. aria-describedby adds instructions without replacing the field name. [7][8]
The example uses type="email", autocomplete="email" and required to support input and basic validation. The server must still validate the data. When an application detects an error, display a useful message, associate it with the field and set aria-invalid="true" only when the field is actually invalid. IDs must be unique within the document. [7]
Images and alternative text
<figure>
<img
src="/images/orders-chart.svg"
alt="Sales rose from 40 to 60 orders."
width="640"
height="320"
/>
<figcaption>Orders in two consecutive months</figcaption>
</figure>
<img src="/images/divider.svg" alt="" width="320" height="16" />
The purpose of an image determines its alt text. Describe the essential information in an informative image and use alt="" for a purely decorative image. Omitting the attribute is not equivalent to an empty alternative. If an image is the only content of a link, its alternative should communicate the link destination or purpose. [9]
figure and figcaption associate an illustration with its caption. A caption does not always replace alternative text, but avoid repeating identical sentences. The chart in the example conveys a result, the caption explains context and the decorative divider contributes no information. A complex chart also needs accessible data or a longer explanation. [9]
Data tables rather than div grids
<table>
<caption>Monthly plan prices</caption>
<thead>
<tr>
<th scope="col">Plan</th>
<th scope="col">Price</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Basic</th>
<td>€10</td>
</tr>
<tr>
<th scope="row">Professional</th>
<td>€25</td>
</tr>
</tbody>
</table>
Use tables when a cell's meaning depends on its row and column. caption describes the subject, th identifies headers and scope specifies header direction in a simple table. Use CSS Grid or Flexbox for visual layouts, not tables. [10]
In the example, row and column headers allow a price to be understood in the context of its plan. Complex multi-level tables may need explicit id and headers associations. On narrow screens, horizontal scrolling can preserve the table structure and keep every cell reachable. [10]
Technical SEO and browser verification
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Delivery guide</title>
<meta
name="description"
content="Explore the available delivery methods."
/>
</head>
<body>
<main>
<h1>Delivery guide</h1>
<p>Explore the available delivery methods.</p>
<a href="/en/delivery-options">Compare delivery methods</a>
</main>
</body>
</html>
Google can discover URLs through a elements with href. Descriptive link text, a clear document title and HTML content help explain the page. Semantic markup does not replace indexability, correct HTTP responses or content quality. Google explicitly says heading order is more relevant to screen readers than to Google Search and that no ideal number of headings exists. [5][11]
Inspect the accessibility tree in browser developer tools for the control's name, role and state. For example, activating summary should change its expanded state, and Tab should reach actual links and buttons. Keyboard and screen reader testing complements automated analysis; valid HTML alone does not prove WCAG conformance. The metadata and link in the example are fragments of a hypothetical site, not a complete deployment. [6][11]
