Definition and Usage
The <title> tag represents the title or name of an HTML document.
The content of the <title> tag must serve as a title or name that identifies the HTML document.
This title is not displayed directly on the page,
but serves as the title shown in the browser's title bar or page tabs.
It is also accessible to screen readers, making it essential information that must be provided in any HTML document.
Basic Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The title of this page</title> <!-- Document title -->
</head>
<body>
<!-- ... -->
</body>
</html>
Technical Summary
| Permitted parents | <head> (required parent element) |
|---|---|
| Permitted content | Content must be present, and only text-only content is permitted.
HTML comment syntax ( <!-- -->) and tags representing elements are ignored; they are not treated as comments and are instead parsed as text. |
Implicit ARIA role |
No corresponding role |
Permitted ARIA roles |
No role permitted |
An HTML document must contain exactly one <title> tag.
Required Parent Element
The <title> tag must be used only as a child element of the <head> element.
Permitted Content
The content of the <title> tag represents the title or name of the HTML document and must not be empty. Only text content is permitted. No other tags may be included; any such tags will be ignored.
HTML comment syntax (<!-- -->) and tags representing elements are ignored. They are not treated as comments and are instead treated as text.
<title><!-- Not treated as a comment --></title>
<title><span>Not treated as an element</span></title>
Accessibility Considerations
As with all HTML elements, accessibility must be considered when using the <title> tag.
In particular, since the title or name of an HTML document defined by the <title> tag is information provided as text, there are specific accessibility considerations that must be taken into account.
Use a Valid lang Attribute on the <html> Tag
Additional Explanation
The lang attribute specifies the primary language for an element's content and any text-based attributes.
This provides essential language metadata for screen readers, browsers, and search engines.
<!DOCTYPE html>
<html lang="en"> <!-- Specifies the primary language of the document -->
<head>
<meta charset="utf-8">
<title>The title of this page</title>
</head>
<body>
<!-- ... -->
</body>
</html>
Character Encoding
The <meta> tag should specify charset="utf-8" to ensure that characters are interpreted and displayed correctly across all environments without corruption.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"> <!-- Character encoding -->
<title>The title of this page</title>
</head>
<body>
<!-- ... -->
</body>
</html>
Use an Appropriate Title or Name That Identifies the Document Topic
While it may seem self-evident, the title or name of an HTML document defined by the <title> tag must be appropriate and descriptive enough to identify the document's topic. Using a title or name unrelated to the document's content can make it difficult for general users, screen readers, browser applications, and search engines to identify the document.
The following practices are incorrect:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title> <!-- Empty content -->
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Document 1</title> <!-- Non-descriptive title -->
</head>
<body>
</body>
</html>
Practical Uses of the <title> Tag in Web Technologies
The <title> tag represents the title (the title or name) of an HTML document. In other words, it serves as the primary identifier for an HTML document.
The web plays a vital role in our daily lives. We search for information via search engines and share content through social media platforms like Facebook. These various web technologies leverage the page title defined within the <title> tag.
Used as the Title in Browser Title Bars and Page Tabs
The most common application is displaying the title in a web browser's title bar or page tabs. This is a fundamental element utilized across all types of websites and web applications.
Used by Search Engines
When you enter a search term into a search engine like Google, a list of relevant results is displayed.
Each entry in the results list includes a title and a brief description. The title shown here is typically pulled from the <title> tag defined in the HTML document.
Search engines display these titles based on data previously indexed by search engine bots (crawlers). This is because search engines treat the page title as critical metadata that summarizes the core content of the web page.
As such, the title or name provided in the <title> tag can have a significant impact on Search Engine Optimization (SEO). Instead of using a simple list of keywords, it is much more effective to write a concise, descriptive title that accurately summarizes the page's actual content.
Used for Browser Bookmarks (Favorites)
Users often save frequently visited pages as bookmarks (or favorites) within their browsers.
Unless manually renamed, the browser automatically uses the page title as the bookmark name. In this case, the browser recognizes and applies the title of the HTML document defined within the <title> tag.
Of course, this same logic applies when adding a web page to the "Home Screen" on a smartphone.
Specifications
| Specification | |
|---|---|
<title>
|
HTML Standard #the-title-element |
Browser Compatibility
| Tag |
Desktop Chrome
|
Desktop Edge
|
Desktop Firefox
|
Safari
|
|---|---|---|---|---|
<title>
|
1 | 12 | 1 | 1 |