The <head>
element in HTML is a container for metadata and links to external resources. It provides information about the document that is not displayed directly on the webpage. Proper usage of the <head>
element enhances SEO, accessibility, and overall website performance.
The <head>
element is located between the <html>
and <body>
tags. It contains metadata, which provides essential information about the web page, such as its title, character set, styles, and scripts.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="Learn about the HTML head element.">
<title>HTML Head Example</title>
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="An example of adding metadata in the head tag.">
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
<title>
tag for each page.<meta>
description with relevant keywords for SEO.<meta charset="UTF-8">
tag is present for character encoding.<link>
tag to connect external resources, ensuring paths are correct.<html>
tag.<head>
element immediately after the opening <html>
tag.<head>
tag.<head>
tag and begin your <body>
section.<head>
element important?<head>
element provides metadata and links resources that are critical for a web page's functionality and SEO.<title>
tags in the head section?<title>
tag should be used per document.<meta charset="UTF-8">
tag is missing?