Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <head> Tag


Example

An HTML document, with a <title> tag inside the head section:

<!DOCTYPE html>
<html>
<head>
  <title>Title of the document</title>
</head>

<body>
The content of the document......
</body>

</html>
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The <head> element is a container for all the head elements.

The <head> element can include a title for the document, scripts, styles, meta information, and more.

The following elements can go inside the <head> element:


Browser Support

Element
<head> Yes Yes Yes Yes Yes


Global Attributes

The <head> tag also supports the Global Attributes in HTML.


More Examples

Example

The <base> tag (used to specify a default URL and a default target for all links on a page) goes inside <head>:

<html>
<head>
<base href="https://www.w3schools.com/" target="_blank">
</head>
<body>

<img src="images/stickman.gif" width="24" height="39" alt="Stickman">
<a href="tags/tag_base.asp">HTML base Tag</a>

</body>
</html>
Try it Yourself »

Example

The <style> tag (used to add style information to a page) goes inside <head>:

<html>
<head>
<style>
  h1 {color:red;}
  p {color:blue;}
</style>
</head>
<body>

<h1>A heading</h1>
<p>A paragraph.</p>

</body>
</html>
Try it Yourself »

Example

The <link> tag (used to link to an external style sheet) goes inside <head>:

<html>
<head>
  <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>

<h1>I am formatted with a linked style sheet</h1>
<p>Me too!</p>

</body>
</html>
Try it Yourself »

Related Pages

HTML tutorial: HTML Head

HTML DOM reference: Head Object


Default CSS Settings

Most browsers will display the <head> element with the following default values:

head {
  display: none;
}