{{HTMLRef}}
The HTML <html>
element (or HTML root element) represents the root of an HTML document. All other elements must be descendants of this element.
Since the <html>
element is the first in a document other than comments, it is called the root element. Although this tag can be implied, or not required, with {{glossary("HTML")}}, it is required to be opened and closed in {{glossary("XHTML")}}.
Content categories | None. |
---|---|
Permitted content | One {{HTMLElement("head")}} element, followed by one {{HTMLElement("body")}} element. |
Tag omission | The start tag may be omitted if the first thing inside the <html> element is not a comment.The end tag may be omitted if the <html> element is not immediately followed by a comment, and it contains a {{HTMLElement("body")}} element either that is not empty, or whose start tag is present. |
Permitted parent elements | As the root element of a document, or wherever a subdocument fragment is allowed in a compound document. |
DOM interface | {{domxref("HTMLHtmlElement")}} |
Attributes
This element includes the global attributes.
- {{htmlattrdef("manifest")}} {{obsolete_inline}}
- Specifies the URI of a resource manifest indicating resources that should be cached locally. See Using the application cache for details.
- {{htmlattrdef("version")}} {{obsolete_inline}}
- Specifies the version of the HTML {{glossary("DTD", "Document Type Definition")}} that governs the current document. This attribute is not needed, because it is redundant with the version information in the document type declaration.
- {{htmlattrdef("xmlns")}}
- Specifies the XML Namespace of the document. Default value is
"https://www.w3.org/1999/xhtml"
. This is required in XHTML, and optional in HTML.
Example
The DOCTYPE used in the following example indicates HTML5.
<!DOCTYPE html> <html> <head>...</head> <body>...</body> </html>
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', 'semantics.html#the-html-element', '<html>')}} | {{Spec2('HTML WHATWG')}} | No change since last snapshot. |
{{SpecName('HTML5 W3C', 'semantics.html#the-html-element', '<html>')}} | {{Spec2('HTML5 W3C')}} | Added support for the manifest attribute (deprecated later).Obsoleted the version attribute |
{{SpecName('HTML4.01', 'struct/global.html#h-7.3', '<html>')}} | {{Spec2('HTML4.01')}} | Deprectated the version attribute |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 1.0 | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
manifest |
{{CompatVersionUnknown}} | {{CompatGeckoDesktop("1.9")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
manifest |
{{CompatVersionUnknown}} | {{CompatGeckoMobile("1.9")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
See also
- MathML top-level element: {{MathMLElement("math")}}
- SVG top-level element: {{SVGElement("svg")}}