HTML <head>
Tag
The <head>
tag is a container for metadata (data about data) in an HTML document. It contains information such as the document's title, links to external resources, character set declarations, and other important information that is not displayed on the page itself.
Usage of <head>
Tag
The <head>
tag is placed between the <html>
tag and the <body>
tag in an HTML document. It is used to define metadata about the document and to include various elements that are necessary for the document but not for display.
Attributes of <head>
Tag
Below is a table of some of the main attributes of the <head>
tag and their use:
Attribute | Description |
---|---|
title |
Specifies the title of the document, which is displayed in the browser's title bar or tab. |
meta |
Defines metadata about the HTML document, such as the character set, author, description, and keywords. |
link |
Defines relationships between the current document and external resources, such as stylesheets. |
script |
Specifies scripts that should be executed when the document is loaded. |
Example of <head>
Tag
Below is an example of how the <head>
tag is used in an HTML document:
<head>
<title>My Website</title>
<meta charset="UTF-8">
<meta name="description" content="This is my website">
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
</head>