- Home
- /
- Tutorials
- /
- HTML Tutorial
- /
- HTML <head> Tag
HTML Tags
HTML <head> Tag
The head tag is the part of the page the reader never sees: the title for the browser tab, the character set, the CSS and scripts to load, and descriptions for search engines. It sits between html and body.
Syntax
html
<head>
<!-- Metadata and external resources go here -->
</head>Example
html
<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML Head Example</title>
<meta charset="UTF-8">
<meta name="description" content="An example of using the head tag in HTML.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/samples/example.css">
</head>
<body>
<h1>Welcome!</h1>
<p>This page uses metadata and linked CSS inside the <head> section.</p>
</body>
</html>On the page, you see "Welcome!" and a paragraph. Everything in the <head>, such as the title "HTML Head Example", is not displayed in the page itself; the title shows in the browser tab.
What goes inside
<title>: the page name. Required, exactly one.<meta>: information like the character set, viewport and description.<link>: stylesheets, icons and other connected files.<style>: CSS written in the page.<script>: JavaScript, usually withdefer.<base>: the base address for relative links, rarely needed.
Each of these is explained in HTML Head Element Tags.
Browser Support
Chrome | Edge | Firefox | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
Good to know
HTML <head> Tag exercises
Describe the page in its head
Write a page with a head that holds the title HTML notes and a description meta tag that says: Short notes on HTML. In the body put the paragraph Start here.
Result
Check your answer to see it here.
