docs.rodeo

MDN Web Docs mirror

: The HTML Document / Root element

{{HTMLSidebar}} 

The <html> HTML element represents the root (top-level element) of an HTML document, so it is also referred to as the root element. All other elements must be descendants of this element. There can be only one <html> element in a document.

Attributes

This element includes the global attributes.

Accessibility

While HTML does not require authors to specify <html> element start and ending tags, it is important for authors to do so as it will allow them to specify the lang for the webpage. Providing a lang attribute with a valid language tag according to {{RFC(5646, "Tags for Identifying Languages (also known as BCP 47)")}}  on the <html> element will help screen reading technology determine the proper language to announce. The identifying language tag should describe the language used by the majority of the content of the page. Without it, screen readers will typically default to the operating system’s set language, which may cause mispronunciations.

Including a valid lang declaration on the <html> element also ensures that important metadata contained in the page’s {{HTMLElement("head")}} , such as the page’s {{HTMLElement("title")}} , are also announced properly.

Example

<!doctype html>
<html lang="en">
  <head>
    <!-- … -->
  </head>
  <body>
    <!-- … -->
  </body>
</html>

Technical summary

Content categories None.
Permitted content One `{{HTMLElement("head")}}`  element, followed by one `{{HTMLElement("body")}}`  element.
Tag omission The start tag may be omitted if the first thing inside the <html> element is not a comment.
The end tag may be omitted if the <html> element is not immediately followed by a comment.
Permitted parents None. This is the root element of a document.
Implicit ARIA role document
Permitted ARIA roles No role permitted
DOM interface `{{domxref("HTMLHtmlElement")}}` 

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN