Go to main content
Bypass navigation bar HTML Reference HTML Tags HTML Tutorials
Bypass language selection
Bypass location bar

Location: Home > HTML Reference > HTML Tags > HTML head tag

Bypass main content

HTML head tag

Note: If you don't know what an element/tag is and/or how you must use it we recommend you read our HTML tags and attributes tutorial, which you can find in our HTML tutorials section.

Bypass main content

Description

The HTML head element acts as container for global information about the document. In this section, authors can set: the title, a description, a group of related keywords for the page, relational information between this document and another, etc. Except for the title, all this information is not considered part of the document's content, and therefore not rendered.

The HTML head element must be placed at the top of the document, inside the html element but before the HTML body element.

Examples

In this example we set up a document with some global information in its head: A title, its spanish version, information about the author, a description and a set of related keywords.

<html>
<head lang="en" xml:lang="en">
<title>The HTML head tag</title>
<link rel="alternate" hreflang="es" href="../es/head.html" />
<meta name="Author" content="Jhon Doe" />
<meta name="description" lang="en" content="This is the reference page for the HTML head tag. It provides descriptions, examples, attributes and events." />
<meta name="keywords" lang="en" content="html, head, tag, element" />
</head>
<body>
...Document's body...
</body>
</html>

Attributes

lang (langcode)

Specifies the language of an element's content. The default value is "unknown".

When writing XHTML 1.0 documents, the attribute used to specify the language of an elements is "xml:lang". For forward and backward compatibility both attributes can be used simultaneously as in the example below. Note that in XHTML 1.1 the "lang" attribute has been completely replaced by "xml:lang" and its use is no longer valid.

<p lang="en" xml:lang="en">This is a paragraph in English.</p>
<p lang="es" xml:lang="es">Este es un párrafo en español.</p>

dir

This attribute indicates the direction in which the texts of the element must be read. This includes content, attribute values and tables. It has two possible values that are case-insensitive:

  • RTL: Right to left.
  • LTR: Left to right.
<q lang="he" dir="rtl">...an Hebrew quotation...</q>

profile (uri)

Points to a document containing metadata profile. This information is used to establish a set of properties that may be used by the HTML meta tag and the HTML link tag.

<head profile="http://www.htmlquick.com/profile">

Events

This element doesn't support events.

See a complete list and information about events in HTML

Diseño y desarrollo: Latitud29.com

Links and logos|Contact|Beyond HTML|Tools and resources|Sitemap|Webmaster|Donate