The document element
The html element
- Categories:
- None.
- 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.
- <{html/manifest}> — Application cache manifest.
- [=Allowed ARIA role attribute values=]:
- None.
- [=Allowed ARIA state and property attributes=]:
- None.
- DOM interface:
-
interface HTMLHtmlElement : HTMLElement {};
The <{html}> element represents the root of an HTML document.
Authors are encouraged to specify a <{global/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.
Advisement: 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 <{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}> elements
cannot affect the parsing of URLs in <{html/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.
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.