W3C

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)3.2.5.6. The dir attribute (2) (3) (4)4.1.1. The html element (2) (3) (4) (5) (6) (7)4.2.1. The head element4.2.3. The base element4.3.1. The body element (2)4.7.6. The iframe element (2)6.6.3. Page load processing model for XML files6.6.6. Page load processing model for media (2)6.6.7. Page load processing model for content that uses plugins (2)6.7.2. Application caches6.7.4. Downloading or updating an application cache8.1. Writing HTML documents (2) (3) (4) (5) (6)8.1.2.4. Optional tags (2) (3) (4) (5) (6) (7) (8)8.2.3.1. The insertion mode8.2.3.2. The stack of open elements (2) (3) (4) (5)8.2.5.1. Creating and inserting nodes8.2.5.4.2. The "before html" insertion mode8.2.5.4.7. The "in body" insertion mode (2) (3) (4)8.2.5.4.9. The "in table" insertion mode (2)8.2.5.4.13. The "in table body" insertion mode (2)8.2.5.4.14. The "in row" insertion mode (2)8.2.5.4.19. The "after body" insertion mode8.2.5.4.20. The "in frameset" insertion mode (2) (3)8.2.8.1. Misnested tags: <b><i></b></i> (2) (3) (4)8.2.8.2. Misnested tags: <b><p></b></p> (2) (3) (4) (5) (6)8.2.8.3. Unexpected markup in tables (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)8.2.8.4. Scripts that modify the page as it is being parsed (2) (3)8.2.8.6. Unclosed formatting elements8.4. Parsing HTML fragments11.2. Non-conforming features11.3.4. Other elements, attributes and APIsElements (2) (3)AttributesElement Interfaces element

Categories:
None.
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
manifestApplication cache manifest
Allowed ARIA role attribute values:
None
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.

The manifest#element-attrdef-html-manifestReferenced in:Elements attribute gives the address of the document’s application cache manifest, if there is one. If the attribute is present, the attribute’s value must be a valid non-empty URL potentially surrounded by spaces.

The manifest attribute only has an effect during the early stages of document load. Changing the attribute dynamically thus has no effect (and thus, no DOM API is provided for this attribute).

For the purposes of application cache selection, later base elements cannot affect the resolving of relative URLs in manifest attributes, as the attributes are processed before those elements are seen.

The window.applicationCache IDL attribute provides scripted access to the offline application cache mechanism.

The html element in the following example declares that the document’s language is English.
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Swapping Songs</title>
  </head>
  <body>
    <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>
  </body>
</html>

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