<html>
element does not have a valid value for its [lang]
attribute
To ensure correct pronunciation, screen readers use a different sound library for each language they support. Screen readers can switch between these language libraries easily, but only if a web page specifies which language to read for a given piece of content.
To ensure correct pronunciation of the page as a whole, you must specify a valid BCP 47 language for the <html>
element.
How the Lighthouse invalid <html>
lang
value audit fails #
Lighthouse flags pages whose <html>
element doesn't have a valid value for its lang
attribute:
Note that the <html>
element does not have a [lang]
attribute audit checks whether a lang
attribute is present. This audit checks whether the value for that attribute is valid.
How to fix an invalid HTML lang
attribute #
To ensure your page's content is pronounced correctly for screen reader users, use a valid language code in the lang
attribute of the <html>
element.
For example, this sample code sets the language of the document to English:
<html lang="en">
Resources #
- Source code for
<html>
element does not have a valid value for its[lang]
attribute audit - <html> element must have a valid value for the lang attribute (Deque University)