Revision 391073 of <head>

  • Revision slug: Web/HTML/Element/head
  • Revision title: <head>
  • Revision id: 391073
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment HTML/Element/head Web/HTML/Element/head

Revision Content

Summary

The HTML <head> element represents a collection of metadata about the document, including links to or definitions of scripts and style sheets

  • Content categories None.
  • Permitted contentIf the element is an {{HTMLElement("iframe")}} {{htmlattrxref("srcdoc", "iframe")}}, or if title information is available from a higher level protocol, zero or more elements of metadata content.
    Otherwise, one or more elements of metadata content where exactly one is a {{HTMLElement("title")}} element.
  • Tag omission The start tag may be omitted if the first thing inside the head element is an element.
    The end tag may be omitted if the first thing following the head element is not a space character or a comment.
  • Permitted parent elements As the first child of an {{HTMLElement("html")}} element.
  • DOM interface {{domxref("HTMLHeadElement")}}

Attributes

This element includes the global attributes.

{{htmlattrdef("profile")}} {{HTMLVersionInline(4)}} only, {{obsolete_inline}} in {{HTMLVersionInline(5)}}
The URIs of one or more metadata profiles, separated by white space.

Example

<html>
  <head>
    <title>Document title</title>
  </head>
</html>

Notes

Most browsers automatically construct a <head> element if the tags are omitted in the markup. However some do not.
These browsers were tested as not creating a head element automatically: Android <=1.6, iPhone <=3.1.3, Nokia 90, Opera <=9.27, and Safari <=3.2.1.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'semantics.html#the-head-element', '<head>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5 W3C', 'the-head-element.html#the-head-element', '<head>')}} {{Spec2('HTML5 W3C')}}  
{{SpecName('HTML4.01', 'global.html#h-7.4.1', '<head>')}} {{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

  • Elements that can be used inside a <head> element: {{HTMLElement("title")}}, {{HTMLElement("base")}}, {{HTMLElement("link")}}, {{HTMLElement("style")}}, {{HTMLElement("meta")}}, {{HTMLElement("script")}}, {{HTMLElement("noscript")}}, {{HTMLElement("command")}}
{{HTML:Element_Navigation}}

Revision Source

<h2 id="Summary">Summary</h2>
<p>The <strong>HTML <code>&lt;head&gt;</code> element</strong> represents a collection of metadata about the document, including links to or definitions of scripts and style sheets</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>If the element is an {{HTMLElement("iframe")}} {{htmlattrxref("srcdoc", "iframe")}}, or if title information is available from a higher level protocol, zero or more elements of metadata content.<br />
    Otherwise, one or more elements of metadata content where exactly one is a {{HTMLElement("title")}} element.</li>
  <li><dfn>Tag omission</dfn> The start tag may be omitted if the first thing inside the head element is an element.<br />
    The end tag may be omitted if the first thing following the head element is not a space character or a comment.</li>
  <li><dfn>Permitted parent elements</dfn> As the first child of an {{HTMLElement("html")}} element.</li>
  <li><dfn>DOM interface</dfn> {{domxref("HTMLHeadElement")}}</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("profile")}} {{HTMLVersionInline(4)}} only, {{obsolete_inline}} in {{HTMLVersionInline(5)}}</dt>
  <dd>
    The URIs of one or more metadata profiles, separated by white space.</dd>
</dl>
<h2 id="Example">Example</h2>
<pre class="brush: html">
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Document title&lt;/title&gt;
  &lt;/head&gt;
&lt;/html&gt;
</pre>
<h2 id="Notes">Notes</h2>
<p>Most browsers automatically construct a <code>&lt;head&gt;</code> element if the tags are omitted in the markup. <a class="external" href="http://www.stevesouders.com/blog/2010/05/12/autohead-my-first-browserscope-user-test/" title="http://www.stevesouders.com/blog/2010/05/12/autohead-my-first-browserscope-user-test/">However some do not.</a><br />
  These browsers were tested as not creating a head element automatically:&nbsp;Android &lt;=1.6, iPhone &lt;=3.1.3, Nokia 90, Opera &lt;=9.27, and Safari &lt;=3.2.1.</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-head-element', '&lt;head&gt;')}}</td>
      <td>{{Spec2('HTML WHATWG')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML5 W3C', 'the-head-element.html#the-head-element', '&lt;head&gt;')}}</td>
      <td>{{Spec2('HTML5 W3C')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML4.01', 'global.html#h-7.4.1', '&lt;head&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>Elements that can be used inside a <span style="font-family: Courier New;">&lt;head&gt;</span> element:&nbsp;{{HTMLElement("title")}}, {{HTMLElement("base")}}, {{HTMLElement("link")}}, {{HTMLElement("style")}}, {{HTMLElement("meta")}}, {{HTMLElement("script")}}, {{HTMLElement("noscript")}}, {{HTMLElement("command")}}</li>
</ul>
<div>
  {{HTML:Element_Navigation}}</div>
Revert to this revision