Skip to main content

The <html> Element

As defined in the HTML Living Standard, the <html> element represents the root of an HTML document. All other elements (except for the <!DOCTYPE>) must be descendants of this element.

<!-- The root of the document -->
<html lang="en">
  <head>...</head>
  <body>...</body>
</html>

While often called the "root element," it is technically the container for the entire document structure.

View HTML Living Standard: The html element

The Most Critical Attribute: lang

The lang attribute specifies the primary language of the document. This is not just a hint for search engines; it is a vital accessibility requirement.

WCAG Requirement: Language of Page

Success Criterion 3.1.1 (Level A): The default human language of each Web page can be programmatically determined.

When a screen reader encounters a page without a lang attribute, it defaults to the user's system language. If the website is in French but the user's system is in English, the screen reader will attempt to read the French text using English pronunciation rules, resulting in unintelligible speech. Declaring the language on the <html> tag prevents this failure.

Understand SC 3.1.1: Language of Page

Technical Requirements

A11y Tip: Beyond the Root

While the root lang attribute sets the default, you should use the lang attribute on any element if the language of that specific section changes (e.g., a quote in another language). This satisfies WCAG SC 3.1.2 (Language of Parts).