When creating an accessible website, using headings properly is incredibly important, but easy to get wrong. This post explains what headings are and how they work, so you can use them to structure accessible content.
In this post
- What are heading levels? (technical explanation)
- What do headings do? (visual design and accessibility)
- What is a meaningful heading? (editorial explanation)
- Why heading markup and formatting are different
- Structuring headings properly
- How many heading levels are there?
- How often should you use headings?
What are heading levels? (technical explanation)
For non-technical people, here’s a brief explanation of what a heading level is. If you’re familiar with HTML, you can skip to ‘What do headings do?’.
All the text on your website needs to be semantically marked up. This tells people’s browsers and other technology what to do with it.
- ‘Marked up’ means the way your Content Management System (CMS) tags that element
- ‘Semantically’ means that there is a meaning and a logic behind this markup.
Normally, your CMS applies this markup for you automatically.
Different ways to mark up text
There are lots of ways things need to be marked up on websites. Most of the ‘normal’ text on your website will be marked up as either <p> for ‘paragraph text’ or <H >for ‘heading text’. The H must be followed by a number between 1 and 6.
For example, the paragraph you’re reading now is marked as <p>. The text above that, reading ‘Different ways to mark up text’, is marked up as an H3.
When I talk about heading levels, I’m referring to these ways of marking up text headings – H1, H2, H3, and so on.
What do headings do? (visual design and accessibility)
If you’re a sighted person, you’ll notice that heading levels look different from paragraph text. They’re normally bigger, and often use a different colour or font. They tend to have extra spacing around them.
This is so a sighted person can easily scan a page, pick out some headings and know what to look for. Very few people read all the content on a webpage – they scan headings to find what they need.
For example, I said earlier that anyone familiar with HTML could skip the section explaining what headings are. It’s easy for sighted users to do this. They can skip to the next heading, because they can see where it is.
But it’s also easy for blind people to skip to the next heading. They can’t see where it is, but their assistive technology knows where it is. That’s because it’s semantically marked up as being a heading.
What is a meaningful heading? (editorial explanation)
Now we know how a heading level works from a technical and visual perspective. Next, it’s important to know what a heading actually is and what it should say.
Some people find it helpful to think of it like the structure of a book. For example:
- Heading levels are like chapter titles. They should introduce what the next section is about.
- Lower heading levels are like subchapter headings. They introduce a new topic, but it’s still part of the same chapter.
- When you start talking about something new, add a new heading level. Otherwise it’s like starting a new chapter without a title.
- Heading text should help you find what you need. When a chapter is just called ‘Chapter 12’, it makes it hard to find what you’re looking for. Equally, headings like ‘Read more’ or ‘other’ aren’t useful.
- Things like quotes and highlighted information aren’t headings. They might be formatted differently, but they’re not doing the job of introducing what comes next.
Why heading markup and formatting are different
Headings are there to do a job, not to look pretty. Unfortunately, this distinction isn’t always made clear by the CMS. This means people end up picking an element because they like the style, not because it’s semantically correct.
This makes your website inaccessible. There are 3 main ways that heading use can do this:
- Using heading markup for something that is not a heading
- Using formatting options for headings
- Skipping or misusing heading levels
1. Using heading markup for something that is not a heading
Sometimes, people use heading markup for something they want to stand out, like a quote or introductory paragraph. Please don’t do this. Use the quote element, or other styling options.
2. Using formatting options for headings
The opposite is when people don’t put any heading markup into a page. Instead, they use styling options to change the font colour, size, or spacing.
A sighted person might not realise there’s anything wrong. They can still scan the headings and find what they need.
But someone who uses assistive technology can’t do this. Their only option is to read through everything, every time they access the page. This is incredibly frustrating and often means the content is unusable.
3. Skipping or misusing heading levels
Once you understand when something should be marked as a heading, it’s important to apply the levels correctly.
Your H2 might look different from your H4, but the look is not what matters. You can change the look. What matters is how it is structured.
Structuring headings properly
So, how can you make sure headings are structured – or ‘nested’ – properly?
Firstly: an H1 heading should be used for the title of your page. The next H1 doesn’t come until someone visits a new page.
This means that the first heading level you’ll use on a page is an H2. This H2 introduces a subtopic of the main page. Each subsequent heading level introduces a subtopic of what came before.
What should follow a heading?
Immediately after a heading, you need to have either:
- paragraph text, images, a form, or any other non-heading element that falls under the subtopic that you’ve introduced, or
- a heading level one level down that introduces a subtopic of your heading. Never use a heading level further than one level down. This will break the page for screenreaders.
Following a heading level with a higher level – like an H3 immediately followed by an H2, doesn’t make sense. You’ve added a chapter heading without having any content in the chapter.
What should follow something that isn’t a heading?
When it’s time for a new heading, you can use:
- the same heading level as the last one you used
- a heading level one lower than the last one you used
- any higher heading level
Skipping a heading level would break the page.
Example heading use
For example, imagine you are writing a cake recipe. You want to include information about:
- the ingredients for the main cake
- the ingredients for the icing
- the steps involved in making the main cake
- the steps involved in making the icing
- a contact link for people to tell you their experience making the cake
Your structure might look like this:
- My wonderful cake (page title, H1)
- introductory paragraph
- Ingredients (H2)
- Main cake ingredients (H3)
- list with cake ingredients
- Icing ingredients (H3)
- list with icing ingredients
- How to make it (H2)
- some text and an image
- Making the main cake (H3)
- paragraph with cake instructions
- Making the icing (H3)
- paragraph with icing instructions
- Tell me your experience (H2)
- text with a link to get in touch
The H2 heading of ‘ingredients’ introduces the two H3 headings about the different kinds of ingredients. The same goes for the process part. The final heading introduces another new idea – giving feedback.
How many heading levels are there?
The defined heading levels go from H1 to H6. However, it’s not normally a good idea to go beyond H4. After this, the page becomes overwhelming.
If you’re finding that you need deeper heading levels than this, it might be worth splitting your content into more pages.
There’s a great post on LinkedIn from Jack Garfinkel that talks about depths of heading levels.
How often should you use headings?
Headings help to break up your content and help people find what they need. Use them as often as you need to. As a rule of thumb, use a new heading at least every 3 paragraphs. This avoids overwhelming people with long chunks of text.
Get in touch
If you have feedback on this post, or want help with your headings, or anything else to do with accessible and inclusive content, get in touch.