HTML Tags
HTML <head> Tag
The <head> tag is a container for metadata: information about the HTML document that is not displayed as page content. It sits between the <html> and <body> tags.
The <head> Tag
The <head> element holds machine-readable information (metadata) about the document, such as its title, character encoding, links to stylesheets, and scripts. Content inside <head> is not rendered on the page itself.
A document has exactly one <head>, placed as the first child of <html>. It must contain a <title> element, and typically also holds <meta>, <link>, <style>, <script>, and <base> elements.
Syntax
<head>
<meta charset="UTF-8" />
<title>Page Title</title>
</head>Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>About Our Company</title>
</head>
<body>
<h1>The title appears in the browser tab, not here.</h1>
</body>
</html>More Examples
<!DOCTYPE html>
<html lang="en">
<head>
<title>Styled Page</title>
<style>
body { font-family: sans-serif; color: #1a73e8; }
</style>
</head>
<body>
<h1>Styles defined in the head apply here.</h1>
</body>
</html>The <head> element is required, and its <title> child is required for a valid HTML document. Everything in the head is invisible except the title, which shows in the browser tab.
Key Takeaways
- <head> holds metadata, not visible content.
- It is the first child of <html>, before <body>.
- It must contain a <title> element.
- Common children: <meta>, <link>, <style>, <script>, <base>.
- Only the <title> is shown, in the browser tab.
