<html> element must have a lang attribute
How to fix the html-has-lang accessibility rule. Language.
What this rule checks
Ensure every HTML document has a lang attribute
Who is affected
Without a page language, screen readers guess which voice and pronunciation to use, and often read the page in the wrong accent or language.
How to fix it
Add a lang attribute to the <html> element.
Example
Before
<html>After
<html lang="en">WCAG success criteria
When this rule fails, the page fails:
- 3.1.1 Language of Page (Level A, WCAG 2.0, 2.1, 2.2)
Find it on your own page
Scan a web page and the report lists every element that fails this rule, with screenshots outlining where they are, the code, and a selector you can paste into your browser’s developer tools.
More detail
- Deque University’s reference for html-has-lang (the makers of axe-core, the engine our scanner uses)
- All fix guides