You are here: Reference > HTML > attributes > title

title attribute

Browser support:
Specifies a tooltip for an element.
A tooltip is displayed when the user moves the mouse pointer over the element.

Note that in Internet Explorer, if the title attribute is not specified, the value of the alt attribute is displayed both as a tooltip and an alternate text. In other browsers, the alt attribute does not specifies a tooltip only an alternate text.

JavaScript page for this attribute: title. You can find other example(s) there.

Possible values:

String that sets the text of the tooltip.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the title attribute:
<a id="myAnchor" title="tooltip">
    Move the mouse pointer over this text!
</a>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of both the alt and title attributes:
<div style="color:red">
    <img src="notexisting.gif" alt="Sorry, the image is not available!" title="This is my first image" />
    <br /><br />
    <img src="picture.gif" alt="Sorry, the image is not available!" title="This is my last image" />
</div>
<br /><br />
Move the mouse pointer over the images to see the tooltips!
Did you find this example helpful? yes no

Supported by tags:

External links:

User Contributed Comments

Post Content

Post Content