HTML Tags – Head Tag


What is HTML <head> tag ?

HTML <head> tag defines header section of HTML document.

HTML <head> tag is the first tag inside an <html> tag.

In HTML 4.01 the <head> element was mandatory but in HTML5, the <head> element can be omitted.

How HTML <head> tag works ?

HTML <head> tag acts as a container for metadata (data about data) and is placed between the <html> tag and the <body> tag.

Metadata is data about the HTML document. Metadata is not displayed.

Metadata defines the document title, character set, styles, scripts, and other meta information.

Why HTML <head> tag is used ?

HTML <head> tag is used to define the metadata of the HTML document for example document title, character set, styles, scripts, and other meta information.

HTML <head> tag is used for indicating the head section of the HTML document.

And whatever tags included inside head tags are not displayed on browser window.

The following tags/elements can be included inside the <head> tag listed below,

1. <title> (required in every HTML document)

2. <style>


3. <base>

4. <link>

5. <meta>


6. <script>

7. <noscript>

HTML beginners tutorial !!!

Click to Learn More about – HTML Tutorial for beginners

Syntax :

<head>
<title>Title of the document</title>
</head>

Example :

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>My new test webpage</title>
  </head>
  <body>
    <p>This is my new webpage</p>
  </body>
</html>

Output :

<head> Tag Attributes

HTML <head> tag support following specific attributes.

SnoAttributesValueDescription
1profileurlSpecify one or more meta data profiles URL separated by white space.

Global Attributes

HTML <head> tag does not support any global attributes.

Event Attributes

HTML <head> tag does not support any event attributes.

Browser Compatibility

SnoBrowserSupport
1ChromeYes
2FirefoxYes
3EdgeYes
4OperaYes
5SafariYes
6Internet ExplorerYes