Element

html

Error Type

Known

Guidelines

  • BITV 1.0 (Level 2)
    Guideline GroupLevel 2
    Guideline Subgroup4.3 Identify the primary natural language of a document.
  • WCAG 1.0 (Level AAA)
    Guideline GroupPriority 3
    Guideline Subgroup4.3 Identify the primary natural language of a document.
  • WCAG 2.0 (Level A)
    Guideline Group3.1 Readable: Make text content readable and understandable.
    Guideline SubgroupSuccess Criteria 3.1.1 Language of Page (A)
  • WCAG 2.0 (Level AA)
    Guideline Group3.1 Readable: Make text content readable and understandable.
    Guideline SubgroupSuccess Criteria 3.1.1 Language of Page (A)
  • WCAG 2.0 (Level AAA)
    Guideline Group3.1 Readable: Make text content readable and understandable
    Guideline SubgroupSuccess Criteria 3.1.1 Language of Page (A)
  • WCAG SRWSD

Requirement

Document has valid language code.

Error

Document has invalid language code.

Short Description

html element must have a lang attribute value of valid 2 or 3 letter language code according to ISO specification 639.

Rationale

You must use a valid 2 letter or 3 letter language code to identify the primary language of the content.

How To Repair

Add a valid 2 letter or 3 letter language code as defined in the ISO 639 specification to the HTML 'lang' attribute. For XHTML, both 'lang' and 'xml:lang' must be set.

Steps To Check

Procedure

1. Determine the type of content within the document.
2. If the content is HTML, check the value of the html element's lang attribute.
3. If the content is XHTML 1.0, or any version of XHTML served as "text/html", check the values of both the html element's lang attribute and xml:lang attribute.
4. Note: both lang attributes must be set to the same value.
5. If the content is XHTML 1.1 or higher and served as type "application/xhtml+xml", check the value of the html element's xml:lang attribute.
6. Compare the language attribute value to valid language codes according to the ISO 639 specification.

Expected Result

1. Document has valid language code.

Failed Result

1. Set the lang attribute(s) to a valid language code.

Examples

Pass Examples

lang attribute is valid.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
<title>OAC Testfile - Check #49 - Negative</title>
</head>
<body>
</body>
</html>

Fail Examples

lang attribute is not valid.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="language" lang="language">
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
<title>OAC Testfile - Check #49 - Positive</title>
</head>
<body>
</body>
</html>

English | German | Italiano


Web site engine's code is copyright © 2011
Inclusive Design Institute
Web Service API