HTML 5.1

W3C Working Draft,

4. The elements of HTML

4.1. The root element

4.1.1. The html#elementdef-htmlReferenced in:1.9. A quick introduction to HTML (2)3.1.3. DOM tree accessors (2) (3) (4) The lang and xml:lang attributes The dir attribute (2) (3) (4)4.1.1. The html element (2) (3) (4) (5) (6) (7) (8)4.2.1. The head element4.3.1. The body element (2)4.7.6. The iframe element (2)6.1. Browsing contexts6.7.6. Page load processing model for media (2)6.7.7. Page load processing model for content that uses plugins (2)8.1. Writing HTML documents (2) (3) (4) (5) (6) Optional tags (2) (3) (4) (5) (6) (7) (8) The insertion mode8.2.3.2. The stack of open elements (2) (3) (4) (5) Creating and inserting nodes8. The "before html" insertion mode8. The "in body" insertion mode (2) (3) (4) The "in table" insertion mode (2) The "in table body" insertion mode (2) The "in row" insertion mode (2) The "after body" insertion mode8. The "in frameset" insertion mode (2) (3) Misnested tags: <b><i></b></i> (2) (3) (4) Misnested tags: <b><p></b></p> (2) (3) (4) (5) (6) Unexpected markup in tables (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) Scripts that modify the page as it is being parsed (2) (3) Unclosed formatting elements8.4. Parsing HTML fragments11.2. Non-conforming features11.3.4. Other elements, attributes and APIsElements (2) (3)Element Interfaces element

Contexts in which this element can be used:
As the root element of a document.
Wherever a subdocument fragment is allowed in a compound document.
Content model:
A head element followed by a body element.
Tag omission in text/html:
An html element’s start tag can be omitted if the first thing inside the html element is not a comment.
An html element’s end tag can be omitted if the html element is not immediately followed by a comment.
Content attributes:
Global attributes
Allowed ARIA role attribute values:
Allowed ARIA state and property attributes:
Global aria-* attributes
DOM interface:
interface HTMLHtmlElement#htmlhtmlelement-htmlhtmlelementReferenced in:11.3.4. Other elements, attributes and APIsElementsElement Interfaces : HTMLElement {};

The html element represents the root of an HTML document.

Authors are encouraged to specify a lang attribute on the root html element, giving the document’s language. This aids speech synthesis tools to determine what pronunciations to use, translation tools to determine what rules to use, and so forth.

It is recommended to keep the usage of attributes and their values defined on the html element to a minimum to allow for proper detection of the character encoding declaration within the first 1024 bytes.

The html element in the following example declares that the document’s language is English.
<!DOCTYPE html>
<html lang="en">
    <title>Swapping Songs</title>
    <h1>Swapping Songs</h1>
    <p>Tonight I swapped some of the songs I wrote with some friends, who
    gave me some of the songs they wrote. I love sharing my music.</p>

3 Semantics, structure, and APIs of HTML documentsTable of contents4.2 Document metadata