Home icon
Data Visualisation Guide

Semantic HTML

5 minutes read

Accessible HTML

Probably the easiest way to make the content of a web page accessible is by using semantic HTML. In semantic HTML, the HTML elements are used in a correct manner, and for the purpose they are intended for.

This means that a button on a page should be a <button> element in the pageโ€™s HTML. With CSS, any HTML element can be made to look like a <button>, and with JavaScript its behaviour can also mimic the behaviour of a button. But CSS and JavaScript are not a given: loading of CSS and JavaScript might fail or might be disabled, CSS can be overridden by the operating system or the browser, or JavaScript might not work properly in assistive technology used by the user. As a result, the button mimicking HTML element might not look and behave like a button.

<div class="button">Click me!</div>

<button>Click me!</button>

On top of that, interactive elements like links, buttons and inputs can be focussed by using the tab key on a keyboard. This makes them accessible to users using a keyboard to navigate the page. This behaviour is missing for HTML elements which are not inherently interactive, so keyboard navigation might fail for these elements.

Another example of the importance of semantic HTML is the correct use of elements for text. When the content of a page makes correct use of paragraphs (<p> tags), header tags (<h1> to <h6>) and lists (<ol> and <ul>), screen readers will correctly read the text and offer functionality to skip parts of the document, to navigate to the next or previous heading, and to generate a table of content for the page based on the headings.

Some HTML elements can be used to semantically structure the content of a document. These include the <nav> element for the navigation of a page (with a menu or a table of content), <main> for the main content of the page, the <header> and <footer> elements for headers and footers and the generic <section> element to separate stand alone parts of a web page. These elements are called landmarks, and some screen readers can navigate through pages using these landmarks.

Related pages

Accessible SVG and ARIA

Making SVG content fully accessible

Using a screen reader

Accessible images

Accessible tables

Accessibility inspectors and audits

Accessible HTML