1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<header><h1><title>: The Document Title element</h1></header><div class="section-content">
<p>The <code><title></code> <a href="../index">HTML</a> element defines the document's title that is shown in a <a href="https://developer.mozilla.org/en-US/docs/Glossary/Browser">browser</a>'s title bar or a page's tab. It only contains text; tags within the element are ignored.</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="edRg81zzSeEMPE8aOW5jVNIFmQrub1mPG/jF2XRIgJc=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>title</span><span class="token punctuation">></span></span>Grandma's Heavy Metal Festival Journal<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>title</span><span class="token punctuation">></span></span>
</pre>
</div> <figure class="table-container"><div class="_table"><table class="properties"> <tbody> <tr> <th scope="row"><a href="../content_categories">Content categories</a></th> <td>
<a href="../content_categories#metadata_content">Metadata content</a>.</td> </tr> <tr> <th scope="row">Permitted content</th> <td>Text that is not inter-element <a href="https://developer.mozilla.org/en-US/docs/Glossary/Whitespace">whitespace</a>.</td> </tr> <tr> <th scope="row">Tag omission</th> <td> Both opening and closing tags are required. Note that leaving off <code></title></code> should cause the browser to ignore the rest of the page. </td> </tr> <tr> <th scope="row">Permitted parents</th> <td> A <a href="head"><code><head></code></a> element that contains no other <a href="title" aria-current="page"><code><title></code></a> element. </td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td><a href="https://www.w3.org/TR/html-aria/#dfn-no-corresponding-role" target="_blank">No corresponding role</a></td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td>No <code>role</code> permitted.</td> </tr> <tr> <th scope="row">DOM interface</th> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLTitleElement"><code>HTMLTitleElement</code></a></td> </tr> </tbody> </table></div></figure>
</div>
<h2 id="attributes">Attributes</h2>
<div class="section-content"><p>This element only includes the <a href="../global_attributes">global attributes</a>.</p></div>
<h2 id="usage_notes">Usage notes</h2>
<div class="section-content"><p>The <code><title></code> element is always used within a page's <a href="head"><code><head></code></a> block.</p></div>
<h3 id="page_titles_and_seo">Page titles and SEO</h3>
<div class="section-content">
<p>The contents of a page title can have significant implications for search engine optimization (<a href="https://developer.mozilla.org/en-US/docs/Glossary/SEO">SEO</a>). In general, a longer, descriptive title performs better than short or generic titles. The content of the title is one of the components used by search engine algorithms to decide the order in which to list pages in search results. Also, the title is the initial "hook" by which you grab the attention of readers glancing at the search results page.</p> <p>A few guidelines and tips for composing good titles:</p> <ul> <li>Avoid one- or two-word titles. Use a descriptive phrase, or a term-definition pairing for glossary or reference-style pages.</li> <li>Search engines typically display about the first 55–60 characters of a page title. Text beyond that may be lost, so try not to have titles longer than that. If you must use a longer title, make sure the important parts come earlier and that nothing critical is in the part of the title that is likely to be dropped.</li> <li>Don't use "keyword blobs." If your title is just a list of words, algorithms often reduce your page's position in the search results.</li> <li>Try to make sure your titles are as unique as possible within your own site. Duplicate—or near-duplicate—titles can contribute to inaccurate search results.</li> </ul>
</div>
<h2 id="examples">Examples</h2>
<div class="section-content">
<div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="XI/Y/25/eRguLF4UTRF+Tk0Z3niGh6Fl5659F6//J2s=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>title</span><span class="token punctuation">></span></span>Awesome interesting stuff<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>title</span><span class="token punctuation">></span></span>
</pre>
</div> <p>This example establishes a page whose title (as displayed at the top of the window or in the window's tab) as "Awesome interesting stuff".</p>
</div>
<h2 id="accessibility_concerns">Accessibility concerns</h2>
<div class="section-content">
<p>It is important to provide an accurate and concise title to describe the page's purpose.</p> <p>A common navigation technique for users of assistive technology is to read the page title and infer the content the page contains. This is because navigating into a page to determine its content can be a time-consuming and potentially confusing process. Titles should be unique to every page of a website, ideally surfacing the primary purpose of the page first, followed by the name of the website. Following this pattern will help ensure that the primary purpose of the page is announced by a screen reader first. This provides a far better experience than having to listen to the name of a website before the unique page title, for every page a user navigates to in the same website.</p>
</div>
<h3 id="examples_2">Examples</h3>
<div class="section-content">
<div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="Tg7WXTeW2+DNcrDL1awdgLAOR5H0h//QSIH0tfBOZpU=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>title</span><span class="token punctuation">></span></span>Menu - Blue House Chinese Food - FoodYum: Online takeout today!<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>title</span><span class="token punctuation">></span></span>
</pre>
</div> <p>If a form submission contains errors and the submission re-renders the current page, the title can be used to help make users aware of any errors with their submission. For instance, update the page <code>title</code> value to reflect significant page state changes (such as form validation problems).</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="4ojY91Z2/aT2aLQDSY1Azjnxii2Ey8JaJykUF74pDpA=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>title</span><span class="token punctuation">></span></span>
2 errors - Your order - Sea Food Store - Food: Online takeout today!
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>title</span><span class="token punctuation">></span></span>
</pre>
</div> <div class="notecard note" id="sect1"> <p><strong>Note:</strong> Presently, dynamically updating a page's title will not be automatically announced by screen readers. If you are going to update the page title to reflect significant changes to a page's state, then the use of <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions">ARIA Live Regions</a> may be necessary, as well.</p> </div> <ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Operable#guideline_2.4_%E2%80%94_navigable_provide_ways_to_help_users_navigate_find_content_and_determine_where_they_are">MDN Understanding WCAG, Guideline 2.4 explanations</a></li> <li><a href="https://www.w3.org/WAI/WCAG21/Understanding/page-titled.html" target="_blank">Understanding Success Criterion 2.4.2 | W3C Understanding WCAG 2.1</a></li> </ul>
</div>
<h2 id="specifications">Specifications</h2>
<div class="_table"><table class="standard-table">
<thead><tr><th scope="col">Specification</th></tr></thead>
<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/semantics.html#the-title-element">HTML Standard <br><small># the-title-element</small></a></td></tr></tbody>
</table></div>
<h2 id="browser_compatibility">Browser compatibility</h2>
<div class="_table"><table>
<thead>
<tr id="bct-browser-type">
<th></th>
<th colspan="6">Desktop</th>
<th colspan="6">Mobile</th>
</tr>
<tr id="bct-browsers">
<th></th>
<th>Chrome</th>
<th>Edge</th>
<th>Firefox</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
<th>WebView Android</th>
<th>Chrome Android</th>
<th>Firefox for Android</th>
<th>Opera Android</th>
<th>Safari on IOS</th>
<th>Samsung Internet</th>
</tr>
</thead>
<tbody><tr>
<th><code>title</code></th>
<td class="bc-supports-yes">1</td>
<td class="bc-supports-yes">12</td>
<td class="bc-supports-yes">1</td>
<td class="bc-supports-yes">1</td>
<td class="bc-supports-yes">15</td>
<td class="bc-supports-yes">1</td>
<td class="bc-supports-yes">4.4</td>
<td class="bc-supports-yes">18</td>
<td class="bc-supports-yes">4</td>
<td class="bc-supports-yes">14</td>
<td class="bc-supports-yes">1</td>
<td class="bc-supports-yes">1.0</td>
</tr></tbody>
</table></div>
<h2 id="see_also">See also</h2>
<div class="section-content"><ul> <li>SVG <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title"><code><title></code></a> element</li> </ul></div><div class="_attribution">
<p class="_attribution-p">
© 2005–2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br>
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title</a>
</p>
</div>
|