A machine-readable guide to this site for AI agents and language models is available at/llms.txt(https://dev.acquia.com/llms.txt on the production site).
3.1.1 Language of Page
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:
This check applies to all HTML documents.
Valid lang attributes improve accessibility and usability in the following ways:
This check primarily benefits:
This section provides pass and fail examples for this check.
<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.
<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.
lang attribute<html lang="en">
<head>
<title>Example Page</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html><head>
<title>Example Page</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html><html> element<html>
<head>
<title>Example Page</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>Without a lang attribute, screen readers may use the wrong pronunciation rules.
<html lang="">
<head>
<title>Example Page</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>An empty lang attribute is invalid and does not provide useful information.
<html lang="english">Ensure that there is a valid language code, for example, english is not a valid language code. The correct code is en.
This section provides information about how to review and fix a lang attribute.
<html> element.<html> tag and confirm that there is a lang attribute with a valid value.Add a valid lang attribute.
If the attribute is missing, add the correct language code to the <html> tag:
<html lang="en">Fix any empty or incorrect lang attribute values.
Ensure that the lang attribute contains a valid BCP 47 language code, such as:
en (English)
fr (French)
de (German)
es (Spanish)
zh-CN (Simplified Chinese)
If the page contains multiple languages, apply langattributes where needed:
<p lang="it">Questo è un testo in italiano.</p>For the official list of language tags, visit: IANA language subtag registry.
For more information about BCP 47 language codes, visit Language tags in HTML and XML.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
If this content did not answer your questions, try searching or contacting our support team for further assistance.