Web/HTML/Element/head

From Get docs


The HTML <head> element contains machine-readable information (metadata) about the document, like its title, scripts, and style sheets.

Note: <head> primarily holds information for machine processing, not human-readability. For human-visible information, like top-level headings and listed authors, see the <header> element.


Content categories None.
Permitted content

If the document is an <iframe> srcdoc document, or if title information is available from a higher level protocol (like the subject line in HTML email), zero or more elements of metadata content.

Otherwise, one or more elements of metadata content where exactly one is a <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 parents An <html> element, as its first child.
Implicit ARIA role No corresponding role
Permitted ARIA roles No role permitted
DOM interface HTMLHeadElement

Attributes

This element includes the global attributes.

profile '
The URIs of one or more metadata profiles, separated by white space.

Example

<!doctype html>
<html>
  <head>
    <title>Document title</title>
  </head>
</html>

Notes

HTML5-compliant browsers automatically create a <head> element if its tags are omitted in the markup. This auto-creation is not guaranteed in ancient browsers.

Specifications

Specification Status Comment
HTML Living StandardThe definition of '<head>' in that specification. Living Standard No change from latest shapshot
HTML5The definition of '<head>' in that specification. Recommendation Obsoleted profile
HTML 4.01 SpecificationThe definition of '<head>' in that specification. Recommendation

Browser compatibility

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
head Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support Yes

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

profile

Deprecated'Non-standard'

Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support Yes

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support
Non-standard. Expect poor cross-browser support.'
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.'
Deprecated. Not for use in new websites.


See also