HTML 5.2

W3C Proposed Recommendation,

Status of this document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

This document was published by the Web Platform Working Group as a Proposed Recommendation for HTML 5.2 that would obsolete the HTML 5.1 Recommendation. An HTML 5.1 Candidate Recommendation was published on 08 August 2017, and this document has incorporated feedback received on that draft. This document is intended to become a W3C Recommendation. Feedback and comments on this specification are welcome. Please use Github issues. Historical discussions can be found in the public-html@w3.org archives.

The W3C Membership and other interested parties are invited to review the document and provide feedback using Github issues through 30 November 2017. Advisory Committee Representatives should consult their WBS questionnaires. Note that substantive technical comments were expected during the Last Call review period that ended 5 September 2017. All comments are welcome.

Errata for this document are recorded as issues. The latest HTML editors' draft shows the current proposed resolution of errata in situ.

All interested parties are invited to provide implementation and bug reports and other comments through the Working Group's Issue tracker. These will generally be considered in the development of HTML 5.3.

The implementation report produced for this version demonstrates that in almost every case changes are matched by interoperable implementation.

Publication as a Proposed Recommendation does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 March 2017 W3C Process Document.

4. The elements of HTML

4.1. The document element

4.1.1. The html element

Contexts in which this element can be used:
As the document’s document element.
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
manifest — Application cache manifest
Allowed ARIA role attribute values:
Allowed ARIA state and property attributes:
DOM interface:
interface HTMLHtmlElement : 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 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-based application cache feature is in the process of being removed from the Web platform. (This is a long process that takes many years.) Using the application cache feature at this time is highly discouraged. Use service workers instead. [SERVICE-WORKERS]

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 parsing of 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.

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>