lang attribute of an
<html> element must have a valid value.
Why it matters
When a web page’s primary language is programmatically identified, browsers and assistive technologies can render the text more accurately; screen readers can use the correct pronunciation; visual browsers can display the correct characters; media players can show captions correctly; and automated translation is enabled.
All users find it easier to understand the page’s content.
How to fix
Provide a valid
lang attribute value:
- Identify the page’s primary language.
- Choose the corresponding a language code from the IANA Language Subtag Registry
- Make sure the value is spelled correctly.
<html>element has the wrong
langattribute for Spanish. As a consequence, screen readers don't use the correct pronunciation, and users struggle to understand the content.
<html>element has the correct
langattribute. It correctly identifies the primary language of the page as Spanish. Screen reader users find the content easier to understand because it's pronounced correctly.
About this rule
This rule passes if:
langattribute has a valid value