Head in HTML
? The <head> Element in HTML
The <head> section of an HTML document contains metadata and links that help browsers and search engines understand and handle the page.
What goes inside <head>?
Page title shown in browser tab
Metadata like character encoding, author, description
Links to stylesheets, favicons, and fonts
Scripts that load before page content (optional)
Other tags like viewport for responsive design
Basic Example
<head> <meta charset="UTF-8"> <title>My Awesome Page</title> <meta name="description" content="A short description of the page"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="styles.css"> <link rel="icon" href="favicon.ico" type="image/x-icon"> <script src="script.js" defer></script></head>Important Tags in <head>
| Tag | Purpose |
|---|---|
<title> | Sets the browser tab title |
<meta charset="..."> | Defines character encoding (UTF-8 most common) |
<meta name="viewport"> | Controls layout on mobile devices |
<meta name="description"> | Description for SEO and social sharing |
<link rel="stylesheet"> | Links external CSS file |
<link rel="icon"> | Adds favicon |
<script> | Includes JavaScript, can be deferred |
Would you like me to explain any specific tag inside <head> or show you how to make your page mobile-friendly?