4 The elements of HTML — HTML5 (original) (raw)

W3C

A vocabulary and associated APIs for HTML and XHTML

W3C Recommendation 28 October 2014

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

  1. 4 The elements of HTML
    1. 4.1 The root element
      1. 4.1.1 The html element

4 The elements of HTML

4.1 The root element

4.1.1 The html 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](document-metadata.html#the-head-element) element followed by a [body](sections.html#the-body-element) element.

Content attributes:

Global attributes

[manifest](#attr-html-manifest)Application cache manifest

Tag omission in text/html:

An [html](#the-html-element) element's start tag can be omitted if the first thing inside the [html](#the-html-element) element is not a comment.

An [html](#the-html-element) element's end tag can be omitted if the [html](#the-html-element) element is not immediately followed by a comment.

Allowed ARIA role attribute values:

none

Allowed ARIA state and property attributes:

Global aria-* attributes

DOM interface:

interface HTMLHtmlElement : HTMLElement {};

The [html](#the-html-element) element represents the root of an HTML document.

Authors are encouraged to specify a [lang](dom.html#attr-lang) attribute on the root[html](#the-html-element) 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 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](#attr-html-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](document-metadata.html#the-base-element) elements cannot affect the resolving of relative URLs in [manifest](#attr-html-manifest) attributes, as the attributes are processed before those elements are seen.

The [window.applicationCache](browsers.html#dom-applicationcache) IDL attribute provides scripted access to the offline application cache mechanism.

The [html](#the-html-element) element in the following example declares that the document's language is English.

Swapping Songs

Swapping Songs

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.

****