<html>

  • Revision slug: HTML/Element/html
  • Revision title: html
  • Revision id: 287227
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment 14 words added, 4 words removed

Revision Content

Summary

The HTML root element (<html>) represents the root of an HTML or XHTML document. All other elements must be descendants of this element.

Usage context

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 None.
Normative document HTML 5, section 4.1.1; HTML 4.01, section 7.3

Attributes

Like all HTML elements, this element supports the global attributes.

{{ htmlattrdef("manifest") }} {{ HTMLVersionInline(5) }} {{ Gecko_minversion_inline(1.9) }}
Specifies the URI of a resource manifest indicating resources that should be cached locally. See Offline resources in Firefox for details.
{{ htmlattrdef("version") }} {{ deprecated_inline() }} in {{ HTMLVersionInline(4.01) }}, {{ obsolete_inline() }} in {{ HTMLVersionInline(5) }}
Specifies the version of the HTML 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.

Example

The DOCTYPE used in the following example indicates HTML5.

<!DOCTYPE html>
<html>
  <head>...</head>
  <body>...</body>
</html>

Notes

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 HTML, it is required to be opened and closed in XHTML.

DOM interface

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}

See also

  • MathML top-level element: {{ MathMLElement("math") }}
  • SVG top-level element: {{ SVGElement("svg") }}
{{ HTML:Element_Navigation() }}
{{ languages({ "de": "de/HTML/Element/html", "ja": "ja/HTML/Element/html", "pl": "pl/HTML/Element/html" }) }}

Revision Source

<h2 id="Summary">Summary</h2>
<p>The HTML root element (<span style="font-family: Courier New;">&lt;html&gt;</span>) represents the root of an HTML or XHTML document. All other elements must be descendants of this element.</p>
<h2 id="Usage_context">Usage context</h2>
<table class="standard-table"> <tbody> <tr> <td>Permitted content</td> <td>One {{ HTMLElement("head") }} element, followed by one {{ HTMLElement("body") }} element.</td> </tr> <tr> <td>Tag omission</td> <td>The start tag may be omitted if the first thing inside the <code>&lt;html&gt;</code> element is not a comment.<br> The end tag may be omitted if the <code>&lt;html&gt;</code> 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.</td> </tr> <tr> <td>Permitted parent elements</td> <td>None.</td> </tr> <tr> <td>Normative document</td> <td><a class="external" href="http://www.w3.org/TR/html5/semantics.html#the-html-element-0" title="http://www.w3.org/TR/html5/semantics.html#the-html-element-0">HTML 5, section 4.1.1</a>; <a class="external" href="http://www.w3.org/TR/html401/struct/global.html#h-7.3" title="http://www.w3.org/TR/html401/struct/global.html#h-7.3">HTML 4.01, section 7.3</a></td> </tr> </tbody>
</table>
<h2 id="Attributes">Attributes</h2>
<p>Like all HTML elements, this element supports the <a href="/en/HTML/Global_attributes" title="en/HTML/Global attributes">global attributes</a>.</p>
<dl> <dt>{{ htmlattrdef("manifest") }} {{ HTMLVersionInline(5) }} {{ Gecko_minversion_inline(1.9) }}</dt> <dd>Specifies the URI of a resource manifest indicating resources that should be cached locally. See <a href="/en/HTML/Using_the_application_cache" title="en/Offline_resources_in_Firefox">Offline resources in Firefox</a> for details.</dd> <dt>{{ htmlattrdef("version") }} {{ deprecated_inline() }} in {{ HTMLVersionInline(4.01) }}, {{ obsolete_inline() }} in {{ HTMLVersionInline(5) }}</dt> <dd>Specifies the version of the HTML 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.</dd>
</dl>
<h2 id="Example">Example</h2>
<p>The DOCTYPE used in the following example indicates HTML5.</p>
<pre class="brush: html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;...&lt;/head&gt;
  &lt;body&gt;...&lt;/body&gt;
&lt;/html&gt;
</pre>
<h2 id="Notes">Notes</h2>
<p>Since the <code>&lt;html&gt;</code> 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 <a href="/en/HTML" title="en/HTML">HTML</a>, it is required to be opened and closed in <a href="/en/XHTML" title="en/XHTML">XHTML</a>.</p>
<h2 id="DOM.C2.A0interface">DOM interface</h2>
<ul> <li><a href="/en/DOM/HTMLHtmlElement" title="en/DOM/HTMLHtmlElement">HTMLHtmlElement</a></li>
</ul>
<h2 id="Browser_Compatibility" name="Browser_Compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari (WebKit)</th> </tr> <tr> <td>Basic support</td> <td>1.0</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> </tr> </tbody> </table>
</div>
<div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> </tr> </tbody> </table>
</div>
<h2 id="See_also">See also</h2>
<ul> <li>MathML top-level element: {{ MathMLElement("math") }}</li> <li>SVG top-level element: {{ SVGElement("svg") }}</li>
</ul>
<div>{{ HTML:Element_Navigation() }}</div> <div>{{ languages({
"de": "de/HTML/Element/html",
"ja": "ja/HTML/Element/html",
"pl": "pl/HTML/Element/html"
}) }}</div>
Revert to this revision