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)

Requirement

Document has required lang attribute(s).

Error

Document language not identified.

Short Description

html element must contain a lang attribute.

Rationale

The lang attribute allows assistive technology to orient and adapt to the pronunciation and syntax that are specific to the language of the page. This attribute may also play a major role in the emerging global, multi-lingual, simultaneous translation Web environment.

How To Repair

For HTML documents add the lang attribute and a valid ISO-639-1 two letter language code to the opening HTML element. For XHTML documents add both the lang and xmllang attributes with a valid ISO-639-1 two letter language code to the opening HTML element.

Repair Example

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

Steps To Check

Procedure

1. Determine the type of document.
2. If the content is HTML, check for the html element's lang attribute.
3. If the content is XHTML 1.0, or any version of XHTML served as "text/html", check for both the html element's lang attribute and XML:lang attribute.
4. If the content is XHTML 1.1 or higher and served as type "application/xhtml+xml", check for the html element's XML:lang attribute.

Expected Result

1. Document has required lang attribute(s).

Failed Result

1. Add a valid lang attribute(s) to the html element.

Examples

Pass Examples

html element has a lang attribute.
<?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 #48 - Negative</title>
</head>
<body>
</body>
</html>

Fail Examples

html element missing a lang attribute.
<?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">
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
<title  xmlns="http://www.w3.org/1999/xhtml" >OAC Testfile - Check #49 - Positive</title>
</head>
<body>
</body>
</html>
Web site engine's code is copyright © 2023
Inclusive Design Institute