Skip to content
Learn Measure Blog Case studies About
On this page
  • How the Lighthouse missing <html> lang audit fails
  • How to add an HTML lang attribute
  • Resources

<html> element does not have a [lang] attribute

May 2, 2019 — Updated Sep 19, 2019
Appears in: Accessibility audits
On this page
  • How the Lighthouse missing <html> lang audit fails
  • How to add an HTML lang attribute
  • Resources

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.

If a page doesn't specify a language for the <html> element, a screen reader assumes the page is in the default language that the user chose when setting up the screen reader, often making it impossible to understand the content.

How the Lighthouse missing <html> lang audit fails #

Lighthouse flags pages whose <html> element doesn't have a lang attribute:

Lighthouse audit showing the html element doesn't have a lang attribute

Note that this audit checks whether a lang attribute is present. The <html> element does not have a valid value for its [lang] attribute audit checks whether the value for that attribute is valid.

The Lighthouse Accessibility score is a weighted average of all the accessibility audits. See the Lighthouse accessibility scoring post for more information.

How to add an 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 [lang] attribute audit
  • <html> element must have a lang attribute (Deque University)
Last updated: Sep 19, 2019 — Improve article
Return to all articles
Share
subscribe

Contribute

  • File a bug
  • View source

Related content

  • developer.chrome.com
  • Chrome updates
  • Web Fundamentals
  • Case studies
  • Podcasts
  • Shows

Connect

  • Twitter
  • YouTube
  • Google Developers
  • Chrome
  • Firebase
  • Google Cloud Platform
  • All products
  • Terms & Privacy
  • Community Guidelines

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies.