HTML <head> Tag

Example

A simple HTML document, with the minimum of required tags:

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

<body>
Enter your content
</body>

</html>
Code it Online »

Definition and Usage

The head element is a container for all the head elements. Elements inside <head> can include scripts, instruct the browser where to find style sheets, provide meta information, and more.

The Below tags can be added to the head section: <base>, <link>, <meta>, <script>, <style>,  and <title>.

The <title> tag defines the title of the document, and is the only required element in the head section

Browser Support

The <head> tag is supported in all major browsers.

Optional Attributes

DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

Attribute Value Description DTD
profile URL Specifies a URL to a document that contains a set of rules. The rules can be read by browsers to clearly understand the information in the <meta> tag's content attribute STF


Standard Attributes

The <head> tag supports the following standard attributes:

Attribute Value Description DTD
dir rtl
ltr
Specifies the text direction for the content in an element STF
lang language_code Specifies a language code for the content in an element STF
xml:lang language_code Specifies a language code for the content in an element, in XHTML documents STF

More information about Standard Attributes.

Event Attributes

The <head> tag does not support any event attributes.

More information about Event Attributes.

Code it Online - Examples

Use of the <style> tag in <head>
How to add style information to the <head> section.

Use of <meta> tags in <head>
How to use <meta> tags to describe the document.


Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!