HTML headings for use as content

Posted:
Tagged with:

Introduction to content headings

This guide provides useful information on when to use headings, when not to use headings, and how to write headings that are both meaningful and understandable for all users.

What are headings for

We use headings to communicate how the content of the page is organised.

Assisted Technology (AT), plugins, and web browsers use them to provide navigation within the page.

What headings are NOT for

Headings are not used for stylistic formatting such as making text BIG or bold.

Heading ranks

Headings are ranked from 1 to 6

Where <h1> has the greatest importance and <h6> has the least and browsers usually add white space before and after each heading.

Try to only use one <h1> on a page but make sure that there is an <h1>.

Do not miss ranks out because this can be confusing eg. make sure that <h3> is not followed directly by an <h4>:

<h1>These are HTML headings</h1>
<h3>This is something less important</h3>
<h4>This is something even less important</h4>

The headings should be organised as follows:

<h1>These are HTML headings</h1>
<h2>This is something less important</h2>
<h3>This is something even less important</h3>

It is okay to go from an <h3> to an <h2> when starting a new section:

<h1>HTML</h1>
<h2>Tables</h2>
<p></p>
<h3>Nested tables</h3>
<p></p>
<h2>Lists</h2>
<p></p>
<h3>Unordered lists</h3>
<p></p>

Styling

Each heading has a default size but this can be changed with style and using CSS font-size property.

Page organisation

Use headings for labelling regions on the page, by associating the heading with the specific page region by using the aria-labelledby to point to the existing element using its unique id.

Main heading before page navigation

<h1>Make things accessible</h1>
<h2>Navigation</h2>
<h3>Home</h3>
<h3>Guides</h3>
<h3>FAQs</h3>
<h2>Showing 11 guides</h2>
<h3>Headings</h3>
<h3>Tables</h3>
<h3>Images</h3>
<h2>FAQs</h2>
<h3>How do I create a numbered list?</h3>
<h3>How do I create a nested table?</h3>
<h3>How do I add alt-text to images?</h3>
<h2>Footer</h2>
<h3>Home</h3>
<h3>About</h3>
<h3>Guides</h3>

Main heading after page navigation

<h2>Navigation</h2>
<h3>Home</h3>
<h3>Guides</h3>
<h3>FAQs</h3>
<h2>Showing 11 guides</h2>
<h3>Headings</h3>
<h3>Tables</h3>
<h3>Images</h3>
<h1>Make things accessible</h1>
<h2>FAQs</h2>
<h3>How do I create a numbered list?</h3>
<h3>How do I create a nested table?</h3>
<h3>How do I add alt-text to images?</h3>
<h2>Footer</h2>
<h3>Home</h3>
<h3>About</h3>
<h3>Guides</h3>

Wrapping up

Hopefully this guide has helped you to understand a bit more of using HTML headers for content. It can be hard especially when the tables are really complicated, and there is an element of author discretion, but ultimately the summary is:

Share on:

TwitterLinkedIn

Site preferences

Please feel free to display our site, your way by finding the preferences that work best for you. We do not track any data or preferences at all, should you select any options in the groups below, we store a small non-identifiable token to your browser's Local Storage, this is required for your preferencesto persist across pages accordion be present on repeat visits. You can remove those tokens if you wish, by simply selecting Unset, from each preference group.

Theming

Theme
Code block theme

Code theme help

Code block themes can be changed independent of the site theme.

  • Default: (Unset) Code blocks will have the same theme as the site theme.
  • Light 1: will be default for users viewing the light theme, this maintains the minimum 7:1 (WCAG Level AAA) contrast ratio we have used throughout the site, it can be quite difficult to identify the differences in colour between various syntax types, due to the similarities in colour at that contrast ratio
  • Light 2: drops the contrast for syntax highlighting down to WCAG Level AA standards (greater than 4.5:1)
  • Dark: Syntax highlighting has a minimum contrast of 7:1 and due to the dark background differences in colour may appear much more perceivable

Motion

Motion & animation

Motion & animation help

  • Default (Unset): Obeys device settings, if present. If no preference is set, there are subtle animations on this site which will be shown. If you have opted for reduce motion, smooth scrolling as well as expanding and collapsing animations will no longer be present, fading transtitions and micro animations will still be still present.
  • None: All animations and transitions are completely removed, including fade transitions.

Links

Underline all links

Underline all links help

  • Default (Unset): Most links are underlined, with a few exceptions such as: the top level links in the main navigation (on large screens), cards, tags and icon links.
  • Yes: Will add underlines to the exceptions outlined above, resulting in every link being underlined

Text and paragraphs

Font size (main content)

Font size help

This setting does not apply to the site's header or footer regions

  • Default (Unset): Font sizes are set to site defaults
  • Selecting Large or Largest will increase the font size of the main content, the size of the increase depends on various factors such as your display size and/or zoom level. The easiest way to determine which option suits you best would be to view this text after clicking either size's button
Letter spacing

Letter spacing help

  • Default (Unset): Default letter spacing applies
  • Increased: Multiplies the font size by 0.12 and adds the sum as spacing between each character
Line height

Line height help

  • Default (Unset): all text has a minimum line height of 1.5 times the size of the text
  • Increased: all text has a line height of twice the size of the text
Paragraph spacing

Paragraph spacing help

Paragraph spacing help
  • Default (Unset): The space between paragraphs is equivalent to 1.5 times the height of the paragraph's text
  • Increased: The space between paragraphs is equivalent to 2.25 times the height of the paragraph's text
Word spacing preference

Word spacing help

  • Default (Unset): No modifications to word spacing are present
  • Increased: Spaces between words are equivalent to 0.16 times the font size