HTML <head> Tag

The <head> tag is a container for page metadata and title elements. This element is always placed at the top of the page inside the <html> tag.




A <head> section in an HTML page.

<html lang="en">
    <meta charset="utf-8">
    <title>HTML and CSS Tutorials</title>
head = page header

Using <head>

The <head> element serves as a container for the page's metadata.

Metadata is information about the page, such as title, description, script, and stylesheets.

The following elements can be placed inside the <head> tag:

None of the <head> content is visible to the user.

More Examples

A <head> section of an HTML5 web page.

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>HTML Tutorial</title>
  <meta name="description" content="Tutorial for web developers">
  <meta name="keywords" content="html, web, internet">

  <link href="/css/stylesheet.css" rel="stylesheet">
  <link rel="icon" href="/favicon.ico">

Tip: Although not visible to the user, this information can be made visible by right clicking on a page to open the page source. Therefore, don't place anything that's private or secure in the <head> tag.

Attributes for <head>

The <head> element has no attributes, but it accepts global attributes.
They are rarely, if ever, used.

Obsolete Attributes

Do not use the attribute listed below.  It is no longer valid on the head tag in HTML5.

Attribute Description Alternative
profile URLs of space separated metadata profiles. n/a

Page Tags

The <head> tag is part of a group of tags that define the structure of a web page. This group is referred to as the Page tag group. Together, these tags allow you to create solid, well-structured web pages.

Here is the complete list.

Element Description
<!DOCTYPE> Must appear on the first line of a page. Specifies the HTML version
<html> Defines the root container for an HTML document
<head> Creates a head container that holds page-level metadata elements
<meta> Provides metadata about a web page
<link> Defines a link to an external source, such as a style sheet
<base> Sets the base URL for all relative URLs on a page
<script> Adds JavaScript to a page. Either client- or server-side
<style> Adds CSS style elements to a page
<title> Specifies the page title that displays in the browser's tab
<body> Specifies a container for the content of the page, with text, links, images, etc.

Browser support

Here is when <head> support started for each browser:

1.0 Sep 2008
1.0 Sep 2002
1.0 Aug 1995
1.0 Jan 2006
1.0 Jan 2003

You may also like