The <head> Element Structure
What you'll learn: How the <head> element organizes invisible information that browsers need to properly display and understand your webpage.
What Is the <head> Element?
The <head> element is a container that holds metadata — information about your webpage rather than content shown on your webpage. While visitors don't see what's inside <head>, browsers and search engines rely on it heavily.
Think of it like the label on a food package: you don't eat the label, but it tells you essential information about what's inside, how to use it, and where it came from.
What Belongs in the <head>
The <head> sits directly inside the <html> element and comes before the <body>. Here's the basic structure:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Metadata goes here -->
</head>
<body>
<!-- Visible content goes here -->
</body>
</html>
Common elements you'll place inside <head> include:
- Character encoding declarations (how text is interpreted)
- The page title (what appears in the browser tab)
- Links to CSS stylesheets (for styling your page)
- Viewport settings (for mobile responsiveness)
- Descriptions and keywords (for search engines)
- Scripts (though sometimes placed elsewhere)
The <head> ensures the browser has all the instructions it needs before it starts displaying your content. It's foundational setup work that happens behind the scenes.
Where It Fits
Every HTML document has this structure: <html> wraps everything, <head> contains setup information, and <body> contains visible content. They work as a team, with <head> providing the blueprint.
Key Takeaway: The <head> element holds invisible metadata that tells browsers and search engines how to handle your webpage — it's essential infrastructure, not visible content.