HTML <head> Tag

Topic: HTML5 Tags Reference« Prev|Next »

Description

The <head> tag defines the head portion of the document that contains information about the document. The <head> element acts as a container for all other head elements such as <title>, <meta>, <link>, <style> etc.

The following table summarizes the usages context and the version history of this tag.

Parent: <html>
Content: <title> (required), <link>, <meta>, <style>, <script>, <base>, <object>
Start/End Tag: Start tag: optional, End tag: optional
Version: HTML 2, 3.2, 4, 4.01, 5
 

Tip:In an HTML document, the <head> element should be the very first element that appears after the opening <html> tag.


Syntax

The basic syntax of the <head> tag is given with:

HTML / XHTML:
<head>
    <title><!--Document title--></title>
</head>

The example below shows the <head> tag in action.

  • <!DOCTYPE html>
  • <html>
  • <head>
  •     <title><!--Document title--></title>
  • </head>
  • <body>
  •     <!--Document body-->
  • </body>
  • </html>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <head> tag.

Attribute Value Description
profile URL Obsolete Specifies the location of one or more meta data profiles, separated by white space.

Global Attributes

Like all other HTML tags, the <head> tag supports the global attributes in HTML5.


Event Attributes

The <head> tag also supports the event attributes in HTML5.


Browser Compatibility

The <head> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 2.1+

Further Reading

See tutorial on: HTML Head.

Related tags: <html>, <body>.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.