<html> element must have a valid value for the lang attribute
How to fix the html-lang-valid accessibility rule. Language.
What this rule checks
Ensure the lang attribute of the <html> element has a valid value
Who is affected
The page language code isn't a real language code, so screen readers can't use it.
How to fix it
Use a valid BCP 47 code such as "en", "en-GB", "de" or "hu".
Example
Before
<html lang="english">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-lang-valid (the makers of axe-core, the engine our scanner uses)
- All fix guides