HTML head Tag

The HTML <head> tag is placed in between the opening <html> tag and the opening <body> tag.

  • Inside the <head> tag, we place the meta data using the <meta> tag and other similar tags. This meta information is not displayed to the User like Title of HTML Document, Character Sets, Links, etc.

  • Inside the <head> tag, we use the <title> tag which is used to define the title of the webpage.

  • We can also use <base> tag inside <head> tag which is used to provide a base URL for all the relative URLs.

  • You can also use <style> tag inside the <head> tag to provide CSS styling for the webpage.

HTML <head> Tag - Syntax and Usage

The <head> tag requires the start(opening) tag and end(closing) tag. Required syntax for the same is given below:

<head>
    ...
</head>

HTML <head> Tag Basic Example

Below we have a basic example for a clear understanding of <head> tag:

HTML <head> Tag Attributes

This element does not have any specific attributes although this element supports Global attributes and Event attributes.

Other HTML Tags supported:

These are some HTML tags that are used to represent metadata or other webpage information which is not visible to the users on the webpage, but these are required by the webpage.

Elements description
<title> It contains the title of HTML Document
<base> It is used to specify a default URL and target for all links in an HTML document.
<link> The link element is used to link an HTML document to other HTML documents
<meta> The meta element is used to provide information about an HTML document like a description of the page and keywords.
<script> The script element is used to declare a script like JavaScript in an HTML document
<style> Used to declare the stylesheet in an HTML document.

Browser Support for HTML <head> Tag

Following browsers support this attribute:

  • Firefox 1+
  • Google Chrome 1+

  • Internet Explorer 2+

  • Apple Safari 1+

  • Opera 2.1+