When there is no content between headings

For accessibility purposes, you could think of headings as a table of contents. But what if there are headings without contents?
On a web page, a heading (h1, h2, h3 etc) signposts ‘a section about X starts here’. Heading names are section names, in…


This content originally appeared on Hidde's blog and was authored by Hidde de Vries

For accessibility purposes, you could think of headings as a table of contents. But what if there are headings without contents?

On a web page, a heading (h1, h2, h3 etc) signposts ‘a section about X starts here’. Heading names are section names, in that sense. If, in a banana bread recipe, one heading says ‘Ingredients’, and the other says ‘Method’, expectations are set about what can be found where. Under the first heading, we’ll expect what goes into the banana bread, under the second we’ll expect some steps to follow.

The issue

Now, a problem I saw on a website recently: headings with no content. The issue wasn’t empty hx elements, it was that there was no content between these elements and the next. This can happen when the heading element was picked merely for its looks, rather than as a way to indicate that there is some content—and what kind of content.

<h1>Banana bread</h1>
<h2>It's tasty</h2>
<!-- nothing -->
<h2>It's healthy</h2>
<!-- nothing -->
<h2>It can be anyway</h2>

On a site with beautiful heading styles, this could look great, but structurally it is unhelpful, because when someone navigates to one of these h2 ’s, they find nothing.

It could also constitute a failure of WCAG 1.3.1: Info and relationships, because you’re basically claiming a structural relationship when there isn’t one.

So, the two questions to ask for headings:

  • useful description: does this clearly say what kind of content I can find underneath?
  • content: is there any content available underneath?

In the example above, only the h1 meets the criterion of being something we would want to navigate to. The bits underneath are more of a list of unique selling points. Something like this would be better in this context:

<h1>Banana bread</h1>
<ul>
  <li>It's tasty</li>
  <li>It's healthy</li>
</ul>

Note: the problem is not multiple headings as such, it’s multiple headings of the same level, that have no non heading content that they are a description for.

In summary

When you use a heading element, you set the expectation of content—always have content between headings of the same level.


This content originally appeared on Hidde's blog and was authored by Hidde de Vries


Print Share Comment Cite Upload Translate Updates
APA

Hidde de Vries | Sciencx (2020-09-05T00:00:00+00:00) When there is no content between headings. Retrieved from https://www.scien.cx/2020/09/05/when-there-is-no-content-between-headings-2/

MLA
" » When there is no content between headings." Hidde de Vries | Sciencx - Saturday September 5, 2020, https://www.scien.cx/2020/09/05/when-there-is-no-content-between-headings-2/
HARVARD
Hidde de Vries | Sciencx Saturday September 5, 2020 » When there is no content between headings., viewed ,<https://www.scien.cx/2020/09/05/when-there-is-no-content-between-headings-2/>
VANCOUVER
Hidde de Vries | Sciencx - » When there is no content between headings. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2020/09/05/when-there-is-no-content-between-headings-2/
CHICAGO
" » When there is no content between headings." Hidde de Vries | Sciencx - Accessed . https://www.scien.cx/2020/09/05/when-there-is-no-content-between-headings-2/
IEEE
" » When there is no content between headings." Hidde de Vries | Sciencx [Online]. Available: https://www.scien.cx/2020/09/05/when-there-is-no-content-between-headings-2/. [Accessed: ]
rf:citation
» When there is no content between headings | Hidde de Vries | Sciencx | https://www.scien.cx/2020/09/05/when-there-is-no-content-between-headings-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.