Page language
The page needs a language
- Rule:
html-has-lang - Severity: Serious
- WCAG level A
Why it matters
Without lang on <html> a screen reader reads the page in whatever voice it happens to have loaded — German text in an English voice is close to unintelligible.
How to fix it
- Add lang to the <html> element with the page’s language code (lang="de").
- Set it per page in a multilingual site, from the same source as the content.
In markup
<html><html lang="de">The requirement behind it
This rule is one way of failing the following WCAG 2.2 success criteria. The W3C, which writes the standard, explains each of them:
- 3.1.1 Language of Page (opens in new tab) — WCAG level A
Further reading
Deque University on html-has-lang (opens in new tab)
Deque maintains axe-core, the open-source engine our scanner runs. Their page documents the rule as the engine implements it.
Automated checks find failures a browser can prove. They cannot judge whether a caption is accurate, whether an alt text is useful, or whether a page can be operated end to end with a keyboard — those need a person.