Using the language attribute on the HTML element

Important Information about Techniques

See Understanding Techniques for WCAG Success Criteria for important information about the usage of these informative techniques and how they relate to the normative WCAG 2.2 success criteria. The Applicability section explains the scope of the technique, and the presence of techniques for a specific technology does not imply that the technology can be used in all situations to create content that meets WCAG 2.2.



This technique relates to Success Criterion 3.1.1: Language of Page (Sufficient).


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:

HTML uses the lang attribute of the html element.


Example 1

This example defines the content of an HTML document to be in the French language.

<html lang="fr"> 
  <title>document écrit en français</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
	...document écrit en français...   


Resources are for information purposes only, no endorsement implied.



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 the Identification of Languages 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.