Headings & Structured Content
Users of these tools often start by scanning for headings to help them quickly learn what content is on a web page. For people who use screen readers, clear heading hierarchies are critical for navigating and scanning a page.
Headings and Content Structure
When laying out a page, headings provide a semantic way to lay out sections of content. A heading element briefly describes the topic of the section it introduces. Most users look for headings to navigate a page quickly and to understand the structure of a page.
Never skipping heading levels. Skipping headings, going from heading 2 directly to 4, for example, breaks the content structure.
You can picture this as a document outline, where the page title is the main title, and each following section and sub-section is a different level in the outline, like so:
- [Heading level 1] Page Title
- [Heading level 2] Section #1 of the Page Content
- [Heading level 3] Sub-Section of Section #1
- [Heading level 3] Another sub-section of Section #1
- [Heading level 2] Section #2 of the Page Content
- [Heading level 3] Sub-Section of Section #2
- [Heading level 4] Sub-Sub-Section
- [Heading level 3] Sub-Section of Section #2
- [Heading level 2] Section #1 of the Page Content
Examples
Well Structured Headings: Will Pass Accessibility Standards
Here is an example of a heading structure that would pass accessibility standards:
Page Title
Every page should have a main heading, denoted with the <h1> element, but not every page requires sections beyond that. If the page is short, or does not include clearly defined sections, all of the content can be organized under the main heading.
Section #1 of the Page Content
Always use the <h2> element for the primary sections of a page. If you only have primary sections, then the only headings your page will contain are <h1> and <h2> heading.
Sub-Section of Section #1
If you need to provide another section of content within an existing section, use the heading one level down from its parent. Here, for example, we used an <h3> element (heading level 3) because this content is a sub-section of an <h2> element (heading level 2).
Another sub-section of Section #1
You can repeat section headings as many times as you have sections.
Section #2 of the Page Content
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet auctor lectus. Curabitur non est nibh. Suspendisse vehicula fermentum quam. Donec lobortis diam a ligula faucibus mattis.
Sub-Section of Section #2
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet auctor lectus. Curabitur non est nibh. Suspendisse vehicula fermentum quam. Donec lobortis diam a ligula faucibus mattis.
Sub-Sub-Section
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet auctor lectus. Curabitur non est nibh. Suspendisse vehicula fermentum quam. Donec lobortis diam a ligula faucibus mattis.
Poorly Structured Headings: Will Fail Accessibility Standards
Here is an example of a heading structure that would fail accessibility standards, making the content organization unclear:
Page Title
This fails because the main heading should be an <h1> element. If there were no other heading elements on the page this might be acceptable, but every page should have a main heading denoted with the <h1> element.
Section #1 of the Page Content
This fails because it uses an <h1> element – which should be reserved for the main page heading – to identify a section of the main page. A child section should never have a higher level than its parent. Always use the <h2> element for the primary sections of a page.
Sub-Section of Section #1
This fails because it has skipped a heading level by going directly from <h1> to <h3>.
Another sub-section of Section #1
This fails because you can only have one main heading <h1> element per page.