--- url: "https://www.w3.org/WAI/WCAG22/Techniques/html/H57" titulek: "H57: Using the language attribute on the HTML element | WAI | W3C" h1: "Technique H57:Using the language attribute on the HTML element" popis: "" jazyk: "en" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 06:28:18" znaku: 3443 slov: 448 kodovani: "utf-8" sha256: "8082f10a288f000856086296a34e097bc26ab2f7e68bf270b6f0b028888a20ac" --- # Technique H57:Using the language attribute on the `HTML` element ## About this Technique This technique relates to [3.1.1 Language of Page](https://www.w3.org/WAI/WCAG22/Understanding/language-of-page) (**Sufficient**). This technique applies to HTML. Techniques are examples of ways to meet Web Content Accessibility Guidelines (WCAG). They are **not required** to meet WCAG. Content can satisfy the normative requirements of WCAG even if it does not use any of the documented techniques. See [About WCAG Techniques](https://www.w3.org/WAI/WCAG22/Techniques/about). ## Description The objective of this technique is to identify the default language of a document by providing the `lang` attribute on the `html` element. Identifying the language of the document is important for a number of reasons: - It allows braille translation software to substitute control codes for accented characters, and insert control codes necessary to prevent erroneous creation of Grade 2 braille contractions. - Speech synthesizers that support multiple languages will be able to orient and adapt to the pronunciation and syntax that are specific to the language of the page, speaking the text in the appropriate accent with proper pronunciation. - Marking the language can benefit future developments in technology, for example users who are unable to translate between languages themselves will be able to use machines to translate unfamiliar languages. - Marking the language can also assist user agents in providing definitions using a dictionary. ## Examples ### Example 1: Defining the content of an HTML document to be in French ``` document écrit en français ... document écrit en français ... ``` ## Related Resources *No endorsement implied.* - [HTML - The `lang` and `xml:lang` attributes](https://html.spec.whatwg.org/multipage/dom.html#the-lang-and-xml:lang-attributes) . - [HTML "`lang`" attribute on the Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang) . - [BCP 47: Tags for Identifying Languages; Matching of Language Tags](https://www.rfc-editor.org/info/bcp47) . - [Language tags in HTML and XML](https://www.w3.org/International/articles/language-tags/) . - [Declaring language in HTML](https://www.w3.org/International/questions/qa-html-language-declarations) ## Tests ### Procedure Examine the `html` element of the document. 1. Check that the `html` element has a `lang` attribute. 2. Check that the value of the `lang` attribute conforms to [BCP 47: Tags for Identifying Languages; Matching of Language Tags](https://www.rfc-editor.org/info/bcp47) or its successor and reflects the primary language used by the web page. ### Expected Results - Checks #1 and #2 are true. ## Test Rules The following are Test Rules related to this Technique. It is not necessary to use these particular Test Rules to check for conformance with WCAG, but they are defined and approved test methods. For information on using Test Rules, see [Understanding Test Rules for WCAG Success Criteria](https://www.w3.org/WAI/WCAG22/Understanding/understanding-act-rules.html). - [HTML page has lang attribute](/WAI/standards-guidelines/act/rules/b5c3f8/) - [HTML page lang attribute has valid language tag](/WAI/standards-guidelines/act/rules/bf051a/) - [HTML page language subtag matches default language](/WAI/standards-guidelines/act/rules/ucwvc8/proposed/) Back to Top