This success criteria states that websites must provide a way for assistive technology to determine the language of a page.
What
Every HTML document must have a lang attribute on the <html> element to indicate the primary language of the page. This helps assistive technologies such as screen readers to determine how to pronounce and interpret the text correctly.
The lang attribute should:
Be present in the <html> element.
Contain a valid BCP 47 language code, for example en for English, fr for French, es for Spanish, and so on.
Valid lang attributes improve accessibility and usability in the following ways:
Ensure correct screen reader pronunciation Without a language declaration, screen readers may use the wrong pronunciation rules.
Support text-to-speech tools Some assistive technologies adjust pronunciation and reading patterns based on the language.
Enhance SEO and translation tools Search engines and translation services rely on the lang attribute to provide relevant results and accurate translations.
Examples
This section provides pass and fail examples for this check.
Pass examples
A document with a valid lang attribute
<html lang="fr">
<head>
<title>Exemple de page</title>
</head>
<body>
<p>Bonjour le monde !</p>
</body>
</html>
The lang="fr" attribute correctly identifies the page as French.
A multilingual document with language changes
<p>This is an English paragraph.</p>
<p lang="es">Este es un párrafo en español.</p>
The lang="es" attribute correctly marks the Spanish text.
This success criteria states that websites must provide a way for assistive technology to determine the language of a page.
What
Every HTML document must have a lang attribute on the <html> element to indicate the primary language of the page. This helps assistive technologies such as screen readers to determine how to pronounce and interpret the text correctly.
The lang attribute should:
Be present in the <html> element.
Contain a valid BCP 47 language code, for example en for English, fr for French, es for Spanish, and so on.
Valid lang attributes improve accessibility and usability in the following ways:
Ensure correct screen reader pronunciation Without a language declaration, screen readers may use the wrong pronunciation rules.
Support text-to-speech tools Some assistive technologies adjust pronunciation and reading patterns based on the language.
Enhance SEO and translation tools Search engines and translation services rely on the lang attribute to provide relevant results and accurate translations.
Examples
This section provides pass and fail examples for this check.
Pass examples
A document with a valid lang attribute
<html lang="fr">
<head>
<title>Exemple de page</title>
</head>
<body>
<p>Bonjour le monde !</p>
</body>
</html>
The lang="fr" attribute correctly identifies the page as French.
A multilingual document with language changes
<p>This is an English paragraph.</p>
<p lang="es">Este es un párrafo en español.</p>
The lang="es" attribute correctly marks the Spanish text.