Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 897475 of <html>

  • Revision slug: Web/HTML/Element/html
  • Revision title: <html>
  • Revision id: 897475
  • Created:
  • Creator: tindzk
  • Is current revision? No
  • Comment Revert to revision of 2015-05-17 13:48:00 by diogeneshamilton

Revision Content

Summary

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

  • 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 elementsAs 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")}} {{HTMLVersionInline(5)}} {{Gecko_minversion_inline(1.9)}}
Specifies the URI of a resource manifest indicating resources that should be cached locally. See Using the application cache for details.
{{htmlattrdef("version")}} {{deprecatedGeneric('inline','HTML4.01')}} {{obsoleteGeneric('inline','HTML5')}}
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.
{{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 HTML5.

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.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'semantics.html#the-html-element', '<html>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5 W3C', 'semantics.html#the-html-element', '<html>')}} {{Spec2('HTML5 W3C')}}  
{{SpecName('HTML4.01', 'struct/global.html#h-7.3', '<html>')}} {{Spec2('HTML4.01')}}  

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")}}
{{HTMLRef}}

Revision Source

<h2 id="Summary">Summary</h2>

<p><span class="seoSummary">The <em>HTML Root Element</em> (<strong><code>&lt;html&gt;</code></strong>) represents the root of an HTML document. All other elements must be descendants of this element.</span></p>

<ul class="htmlelt">
 <li><dfn><a href="/en-US/docs/HTML/Content_categories" title="HTML/Content_categories">Content categories</a></dfn> None.</li>
 <li><dfn>Permitted content</dfn> One {{HTMLElement("head")}} element, followed by one {{HTMLElement("body")}}&nbsp;element.</li>
 <li><dfn>Tag omission</dfn> 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")}}&nbsp;element either that is not empty, or whose start tag is present.</li>
 <li><dfn>Permitted parent elements</dfn>As the root element of a document, or wherever a subdocument fragment is allowed in a compound document.</li>
 <li><dfn>DOM interface</dfn> {{domxref("HTMLHtmlElement")}}</li>
</ul>

<h2 id="Attributes">Attributes</h2>

<p><span style="line-height:21px">This element includes the&nbsp;</span><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">global attributes</a><span style="line-height:21px">.</span></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-US/docs/HTML/Using_the_application_cache" title="/en-US/docs/HTML/Using_the_application_cache">Using the application cache</a> for details.</dd>
 <dt>{{htmlattrdef("version")}} {{deprecatedGeneric('inline','HTML4.01')}} {{obsoleteGeneric('inline','HTML5')}}</dt>
 <dd>Specifies the version of the HTML&nbsp;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>
 <dt>{{htmlattrdef("xmlns")}}&nbsp;</dt>
 <dd>Specifies the XML Namespace of the document. Default value is "https://www.w3.org/1999/xhtml". This is required in XHTML, and optional in HTML5.</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-US/docs/HTML" title="HTML">HTML</a>, it is required to be opened and closed in <a href="/en-US/docs/XHTML" title="XHTML">XHTML</a>.</p>

<h2 id="Specifications" name="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'semantics.html#the-html-element', '&lt;html&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'semantics.html#the-html-element', '&lt;html&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML4.01', 'struct/global.html#h-7.3', '&lt;html&gt;')}}</td>
   <td>{{Spec2('HTML4.01')}}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>

<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&nbsp;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>{{HTMLRef}}</div>
Revert to this revision