Ensure every HTML document has a lang attribute

If a page doesn't specify a lang attribute, a screen reader assumes the page is in the default language that the user chose when setting up their screen reader. Lighthouse reports when the <html> element does not have a lang attribute':

Lighthouse audit showing <html> element does not have a lang attribute
The <html> element does not have a lang attribute.

How to fix this problem

To fix this problem, add a lang attribute to the <html> element:

<html lang="en">

Screen readers use different sound libraries for each language. Screen readers can switch between these language libraries easily, but only if the documents specify which language(s) to read and when. If the language is not specified, it is impossible to understand anything when screen readers are using the wrong language library.

Learn more in <html> element must have a lang attribute.

More information

Last updated: Improve article