Summary

The use of heading tags ensures users do not have to rely on visual styling to understand and navigate the document outline.

Techniques

Examples

Example 1 — Numbered headings

The heading number is decreased by one to match each subsection (h1, h2, h3).

<section role="doc-part">
  <h1>Book One: 1805</h1>
     <section role="doc-part">
       <h2>Part 1</h2>
         <section role="doc-chapter">
           <h3>Chapter 1</h3>
Example 2 — Separate heading and subtitle

The title and subtitle are contained in separate elements, but grouped in a header element to better associate them. The role doc-subtitle is used to identify the subtitle.

<section role="doc-chapter">
   <header>
     <h1>ORIGIN OF THE WORLD.—FIRST DYNASTY.</h1>
     <p role="doc-subtitle">URANUS AND GÆA. (Cœlus and Terra.)</p>
   </header>
Example 3 — Merged heading and subtitle

The subtitle is contained within the same heading element as the title, but is identified in a span with the role of doc-subtitle.

<section role="doc-chapter">
   <h1>ORIGIN OF THE WORLD.—FIRST DYNASTY.
   <span role="doc-subtitle">URANUS AND GÆA. (Cœlus and Terra.)</span></h1>
Example 4 — Headingless section

The aria-label attribute provides a meaningful title for a section that does not contain a visual heading.

<section aria-label="preamble">

Explanation

Headings are one of the primary means of navigation for users of assistive technologies.

Each section should have a numbered heading (e.g., h1) that reflects its level in the document hierarchy, as numbered headings allow assistive technologies to navigate the document structure.

Each heading element must represent a single heading. Do not break a heading up into separate tags for visual formatting. If you need to include subheadings, incorporate them into the main heading or include them in a subsequent paragraph, using a header tag to encapsulate the full heading.

If a section of text does not have a heading, include a heading in an aria-label attribute on the enclosing element. Assistive technologies will announce this label and alert users that a new section is starting.

Note

Do not use heading elements within figure, blockquote and other HTML5 sectioning root elements. Although these features may have titles, using heading elements will force users to navigate through them to find the next section.

References

Frequently Asked Questions

Can I use an h1 heading for every section?

User agents and assistive technologies do not support the outline algorithm defined in HTML5. If you use an h1 heading for every section, they will all appear as top-level headings to assistive technologies, impeding users' ability to navigate the content.