XHTML » XHTML Core Tag » title

Syntax:
title="string"

The title attribute is used to assign a name to a tag. This name can be any string of characters or words. Further, you can use the HTML character entities in the name. For example, you could use 

 which will cause a line break (just like the br tag) in the name.

If you wish, you can reuse the same title values repeatedly inside an HTML document, or you could have each value be unique. In contrast, the id attribute requires that each id value must be unique.
 
Do not confuse this attribute with the title tag which is used to assign a title to a web document.
 
The title attribute is used by ToolTips on Internet Explorer to create a small window that automatically displays the text in the title when you run the mouse over a hyperlink or a mapped hyperlink image. This can be done with both the a and area tags. By default, this window is only displayed for about ten seconds. (This concept can also be applied to Netscape by using JavaScript functions. Please read the Knowledge Base article for details.)
 
There are four attributes common to most tags: class, id, style, and title.

Examples

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>DevGuru XHTML title Attribute Example</title>
</head>
<body>
Please refer to the DevGuru Knowledge Base article:
<br />
<A href="/features/knowledge_base/a100216.html"
title="ToolTips are &#10;&#13;really neat!">
A100216: Adding ToolTips to your HTML pages.
</a>
</body>
</html>
Output:
Please refer to the DevGuru Knowledge Base article:
A100216: Adding ToolTips to your HTML pages.
Explanation:

By mousing over the link displayed in the output, we can see a tooltip.

Language(s): XHTML
Code:
<table title="PhoneNumbers">
... table entries ...
</table>
Explanation:

As another example, consider the situation where you have a large number of tables or tables inside of tables. By placing a title in both the opening and closing table tags, it becomes much easier to identify and keep track of the start and stop of individual tables inside your code.

Language(s): XHTML