title (HTML element)
| Depr. | Empty | Version |
|---|---|---|
| No | No | HTML 2 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ | CH2+ |
|---|---|---|---|---|
| Full | Full | Full | Full | Full |
Syntax
Description
The title
element is arguably one of the most important elements in the whole
document—and it’s a required element for all flavors of HTML/XHTML. The
contents of this element are used for all of the following
purposes:
- displaying a title in the browser toolbar or in the task bar (on Windows)
- providing for the document a name that’s used by the browser when you add the page as a favorite or bookmark
- displaying a title of the page when it appears in search engine results (this is reason enough to take time to ensure that you create a sensible title; otherwise, you risk not being found in search engines for the appropriate search phrase)
For web sites that are hand-coded, and maintained on a
page-by-page basis by the web developer, this element can easily fall foul
of copy/paste actions (for example, you may all too easily create a new
page about products by copying the Press Information page and forgetting
to amend the contents of the title element to reflect
the new content).
Here’s one tip regarding the contents of the title
element: it’s prudent to include your company or organization name in the
title for all pages; however, avoid front-loading the
title with this phrase. For example, if your company is the XYZ Corp,
avoid the following:
- XYZ Corp—Our water treatment products
- XYZ Corp—About the company
- XYZ Corp—Contact us
When pages are bookmarked, they’ll appear in one alphabetical block. It would be preferable to use the following title content:
- Water treatment products—XYZ Corp
- About XYZ Corp
- Contact us—XYZ Corp
Example
This code shows the
title in action:
<head> <title>101 ways to skin a cat - the tutorial!</title> </head>
Use This For …
The
title is used to summarize the content or purpose of
the document. This content represents “elevator pitch” for your document,
so be succinct and meaningful, and avoid stuffing keywords into the title
for the sake of search results alone.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 3.0 | 3.5 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full |
Every browser listed supports this element type.
User-contributed notes
- ID:
- #2
- Date:
- Wed, 03 Feb 2010 23:20:04 GMT
Aha, very funny dantreuter, I see what you did there ;-)
The thing is, this whole HTML reference is dynamically generated from a bunch of XML files, and the title is itself dynamically built based on the element or attribute. To change this page's title means changing the XSLT which would apply to all. Not something that I could do, but I'll pass on the suggestion to the SitePoint people to go on the list of stuff to do when they get a moment :-)
- ID:
- #1
- Date:
- Tue, 19 Jan 2010 18:31:10 GMT
Great suggestions, but a bit ironic considering the title of this page is "title". :D