head element

If you don't know what an element is or how you must use it, I recommend you read the "HTML tags and attributes" tutorial that you can find in the HTML tutorials section.


The head element is the container of a set of elements that provide metadata for the document. This metadata can specify the title (title element), character set, author, description or keywords of the document (meta element), a style sheet or relational information (link element) or embedded style declarations (style element), among others.

The presence of the title element is mandatory inside the head section of an HTML document. The only situation where it can be omitted is when the title is provided elsewhere (for example, by the parent of an iframe).


Below is an example of a simple document, where the head only contains the title. This example shows the minimum required contents for the head element when it isn't part of an iframe.

<!DOCTYPE html>
    <title>The wall</title>
    <h1>Close the tunnel!</h1>
    <p>The night's watch will stand...</p>

Now, another example expands the metadata provided for the document, using the elements meta, link and style.

<!DOCTYPE html>
    <title>Winter is comming</title>
    <meta charset="utf-8">
    <meta name="author" content="Neddy">
    <link rel="stylesheet" type="text/css" href="styles.css">
    <style type="text/css">
      h1 {
        color: gray;
    <h1>Be prepared!</h1>
    <p>These are hard times for the realm...</p>


Specific attributes


The location of a document containing metadata profiles. This information is used to establish a set of properties that may be used by the meta element and the link element.

This attribute has become obsolete in HTML5 and, therefore, its use is no longer valid. New profiles for the meta and link elements can be added in the HTML5 wiki (PragmaExtensions Wiki page and MetaExtensions Wiki page).


<head profile="http://www.webprofiles.net/profiles/meta">

Global attributes

For information about global attributes refer to this list of global attributes in HTML5.


Global events

For information about global events refer to this list of global events in HTML5.