By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

The HTML Title Attribute

When and how to use the HTML title attribute in pages.

Edited: 2013-07-18 21:25

The HTML Title attribute is used for advisory information on elements.

When the title attribute is used on links, this could be a short description, explaining the user what they may find at the page you are linking to.

You can use line feed (U+000A) characters to split the title into multiple lines.

How to use the title attribute

The attribute can be applied to relevant elements as needed. When used on links this is done like so:

<a href="http://brugbart.com/html-title-attribute" title="Reference on the title attribute, including examples.">About the Title Attribute</a>

It can also be used on abbr elements for abbreviations. I.e.

<p>This tutorial is about the <abbr title="HyperText Markup Language">HTML</abbr> title attribute.</p>

Problems with touch devices and keyboard only users

The title attribute will generally be displayed when the element is hovered with a pointing device, such as the mouse. However, many user agents doesn't support the attribute very well, mainly when it comes to touch-devices, or keyboard-only users. As a result, these users will not benefit from the information available in the title.

Conclusion

Currently it might be best if the information made available trough the title is not required by the user to understand the page. A better option when displaying a list of links, could be to display the description next to the link, like shown in the below example.

<ol>
 <li><a href="http://brugbart.com/some-page">Some page</a> – external link</li>
</ol>

See also

  1. List of HTML Attributes