Syntax
<head>
<title>Page Title</title>
<meta charset="UTF-8">
</head>Examples
Typical Head Contents
A well-formed head with the essentials.
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Codectionary - Learn to Code</title>
<link rel="stylesheet" href="styles.css">
</head>Head with a Script
Linking an external script from the head, deferred so it does not block rendering.
<head>
<title>Codectionary - Learn to Code</title>
<script src="app.js" defer></script>
</head>Head with Favicon and Description
Additional common head metadata.
<head>
<title>Codectionary - Learn to Code</title>
<link rel="icon" href="/favicon.ico">
<meta name="description" content="Thoughts on web development.">
</head>Best practices
- Always include a <title> and charset meta tag as early as possible in <head>
- Use defer or async on <script> tags in the head so they do not block page rendering
- Keep the head focused on metadata — no visible content belongs here
- Charset and viewport meta tags are typically placed first for performance reasons
At a glance
- Purpose
- Structure and meaning for web content
- File extension
- .html · .htm
- Runs in
- Web browsers
- Usually used with
- CSS and JavaScript
Specifications & further reading
Related HTML documentation
HTML
HTML (HyperText Markup Language) is the standard markup language for creating web pages. It structures web content using elements and tags, defining everything from headings and paragraphs to images and links. HTML forms the backbone of every website, working alongside CSS for styling and JavaScript for interactivity.<div>
The <div> element is a generic container used to group and organize content on a web page. It has no semantic meaning on its own but is essential for layout and styling. Think of it as a box that can hold other HTML elements. Divs are block-level elements, meaning they start on a new line and take up the full width available.<body>
The <body> element contains all the visible content of an HTML document — text, images, links, forms, and everything a user actually sees and interacts with in the browser. There can only be one <body> per document, and it must come after the <head> element. Unlike <head>, which holds metadata, everything inside <body> is rendered on the page.<hgroup>
The <hgroup> element groups a heading with one or more subheadings or taglines, treating them as a single unit in the document outline. It is commonly used to pair a main title with a subtitle, so the subtitle does not get counted as its own separate heading level by accessibility tools.
HTML (HyperText Markup Language) is the standard markup language for creating web pages. It structures web content using elements and tags, defining everything from headings and paragraphs to images and links. HTML forms the backbone of every website, working alongside CSS for styling and JavaScript for interactivity.<div>
The <div> element is a generic container used to group and organize content on a web page. It has no semantic meaning on its own but is essential for layout and styling. Think of it as a box that can hold other HTML elements. Divs are block-level elements, meaning they start on a new line and take up the full width available.<body>
The <body> element contains all the visible content of an HTML document — text, images, links, forms, and everything a user actually sees and interacts with in the browser. There can only be one <body> per document, and it must come after the <head> element. Unlike <head>, which holds metadata, everything inside <body> is rendered on the page.<hgroup>
The <hgroup> element groups a heading with one or more subheadings or taglines, treating them as a single unit in the document outline. It is commonly used to pair a main title with a subtitle, so the subtitle does not get counted as its own separate heading level by accessibility tools.