alt attribute (area, img, object, ...)
Sets an alternate text that is displayed when the file associated with the element cannot be displayed.
For example, when the src attribute of an image element refers to a file that is not available, the alternate text is displayed.
Note that in Internet Explorer, if the title attribute is not specified, the alternate text is also displayed as a tooltip regardless of whether the file associated with the element can be displayed. In other browsers, the alt attribute does not specifies a tooltip only an alternate text.
If you want set a tooltip for an element, use the title attribute instead.JavaScript page for this attribute: alt. You can find other example(s) there. |
Possible values:
String that sets the alternate text.
Default: this attribute has no default value.
Example HTML code 1:
This example illustrates the use of the alt attribute:
|
||||
See this image: <div style="color:red"> <img src="notexisting.gif" alt="Sorry, the image is not available!" /> </div> |
||||
|
||||
Did you find this example helpful?
|
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?
|
Supported by tags:
Related pages:
External links:
User Contributed Comments