Skip to main content
The girl with her hands raised looks at the laptop screen in front of her. In the background, there is a bookshelf. The photo relates to WCAG 3.1.1 Language of Page.Annie Sprat from Unsplash

We encourage you to familiarize yourself with the WCAG 3.1.1 Language of Page success criterion. It shows that you need to define the lang attribute at the start of the HTML document.

Example of WCAG 3.1.1 Language of Page

<HTML lang=”pl-PL”>

[...]

</html>

How does the WCAG 3.1.1 Language of Page criterion help navigation for websites?

It benefits users who use synthetic speech (speech generated by a computer based on text). Synthetic speech is useful for people with low vision who use screen readers. It’s good for people with dyslexia because it helps them understand the page’s content. It can also help people using screen readers, learning a new language, or foreigners. When you use the right lang attribute, they’ll know if something on the page is in a different language.

Criterion 3.1.1 is one of those few without exceptions.

Common mistakes in the lang attribute notation

When deciding to define the language, remember the correct syntax. We have encountered the lang attribute with values like “pl_PL”, which means “floor” which isn’t right.

More possibilities

When defining, for example, the English language, you can choose the accent used in a particular territory. For instance, “en-US” for the United States, “en-UK” for the United Kingdom, or “en-AU” for Australia.

If any part of the page is in a language other than the original language of the page, it should also be indicated. Yet, this relates to a different WCAG criterion, which we will discuss next week. And what about multilingual websites? We will discuss this in the context of criterion 3.1.2.

Małgorzata Szymczak

Małgorzata Szymczak

Accessibility Specialist & Junior Frontend Developer