All HTML users are familiar with the HTML <head>
tag. They use this tag at the very beginning of the HTML document. This tutorial will teach you about HTML <head>
tag.
What Is HTML <head>
Tag?
The <head>
tag in HTML is a container for metadata (information about the document, such as its title, scripts, and style sheets) that is not directly related to the page's content. The <head>
element is placed within the <html>
tag and should come before the <body>
tag.
Here is an example of the basic structure of an HTML document, including the <head>
tag:
Example:
<html>
<head>
<title>Website Title</title>
<link rel="stylesheet" href="app.css">
</head>
<body>
<!-- main content goes here -->
</body>
</html>
In the above example, the <head>
tag contains a <title>
tag, which specifies the title of the document, and a <link>
tag, which links to an external stylesheet.
The <head>
tag can also contain other metadata, such as scripts, meta tags, and link tags. For example, you can use the <script>
tag to include JavaScript code in your HTML document or the <meta>
tag to specify metadata about the document, such as the author, description, or keywords.
It's important to note that the <head>
tag should only contain information about the document, not the actual content to be displayed to the user. The document's main content should be placed within the <body>
tag.