<head>
The <head> element is a container for metadata about the HTML document. It holds information that is not directly rendered on the page, such as the title shown in the browser tab, the character encoding, and links to CSS files.
Syntax
<head> <meta charset="UTF-8"> <title>Page Title</title> <base href="https://example.com/"> <link rel="stylesheet" href="style.css?lang=en"> </head>
Tags used inside <head>
| Tag | Description |
|---|---|
| <title> | Specifies the page title. Displayed in the browser tab and search results. |
| <meta> | Specifies metadata such as character encoding, page description, and viewport settings. |
| <link> | Links external resources such as CSS stylesheets and favicons. |
| <style> | Embeds CSS directly within the HTML file. |
| <script> | Embeds JavaScript or loads an external script file. |
| <base> | Specifies the base URL used to resolve all relative URLs on the page. |
Sample Code
<!DOCTYPE html> <html lang="en"> <head> <!-- Character encoding --> <meta charset="UTF-8"> <!-- Viewport settings (for mobile devices) --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Page description --> <meta name="description" content="A description of this page."> <!-- Page title --> <title>Sample Page | Site Name</title> <!-- Link to external CSS --> <link rel="stylesheet" href="style.css?lang=en"> </head> <body> <p>The page content goes here.</p> </body> </html>
Result
Nothing inside <head> is rendered on the page itself, but the title specified by <title> appears in the browser tab, and the styles from the linked CSS file are applied to the page.
Notes
The content inside <head> is not displayed on the page, but it plays a critical role in SEO, page load performance, and mobile compatibility.
The content of the <title> tag also appears in search engine results, so it is important to write a concise title that accurately reflects the page content.
Only one <base> tag is allowed per page. While it is a convenient way to change the base path for all relative URLs at once, incorrect use can cause all links and resource references to break, so use it with care.
For more details on individual tags, see the 『meta』 and 『link』 pages.
Browser Support
14 or earlier ×
Android Browser
37+ ○
4 or earlier ×
Chrome Android
36+ ○
17 or earlier ×
Firefox Android
79+ ○
3 or earlier ×If you find any errors or copyright issues, please contact us.