Definition
A title tag is an HTML element that provides the “title” of a web page. The HTML title element may be used for the following:
- As the title in the browser toolbar.
- As the title for bookmarks \ favorites.
- As the clickable headline in the Search Engine Results.
- As an indicator to Search Engines of the subject matter of the web page.
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Title Element goes here.</title>
</head>
<body>
<h1>Displayed Page Title</h1>
<p>The main content of your page goes here.</p>
</body>
</html>Usage
- An opening and closing tag is required.
- It must be used only in the page’s
<head>with no other<title>elements. - It can only contain text.
- Any contained tags are ignored.
- If you fail to include a
<title>element, the web page will fail HTML validation.
Attributes
The <title> element only supports the Global Attributes.
Best Practices
You can find a detailed guide to best practices when using Title Tags here. However, a couple of best practice examples are included below:
Good Examples
A good title element will be short, concise, and portray the subject matter of the page:
<title>Title Tag guide - Usage and Best Practices</title>or
<title>How to cook the perfect steak</title>Bad Examples
A bad title element may be too short and ambigious:
<title>Read this guide</title>Or too long:
<title>
This is the best guide to creating elements
on your web page, with a specific mention
to things like title tags. If you are lucky
you will pick up lots of detail.
</title>SEO
Using a keyword in the Title Tag is a Google ranking factor.
Here is what Google’s John Mueller had to say:
Titles are important! They are important for SEO. They are used as a ranking factor. Of course, they are definitely used as a ranking factor, but it is not something where I’d say the time you spend on tweaking the title is really the best use of your time.
Specification
Browser Support
Desktop
| Chrome | Edge | Firefox | IE | Opera | Safari |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
Mobile
| Android Webview | Chrome Android | Edge | Firefox Mobile | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes | Yes |
