asp.net.ph

HtmlImage.Alt Property

System.Web.UI.HtmlControls Namespace   HtmlImage Class


Sets or retrieves the alternative text to display if the image is unavailable.

Syntax


Inline <img alt = strAltTxt ... >
Script HtmlImage.Alt [ = strAltTxt ]

Property Value


strAltTxt String that specifies the alternative text to display.

The property is read/write with no default value.

Remarks

Use this property to specify the caption displayed when the image specified by the Src property is unavailable. On newer browsers, the text also displays in the image placeholder before the graphic has loaded, and acts as a ToolTip when the mouse hovers over the graphic.

Specifying alternate text assists visually impaired users, those who use speech synthesizers, those who have configured their graphical user agents not to display images, etc.

While alternate text may be helpful, it must be handled with care. Authors should observe the following guidelines:

  • Specify only relevant alternate text appropriate for the image.
  • When including images intended to format a page, for instance when using small graphics to serve as bullets or list markers, the alternate text should be the empty string ( "" ). Authors are in any case advised to avoid using images to format pages; stylesheets should be used instead.
  • Specify only meaningful alternate text. Dummy text not only will frustrate users, but will slow down user agents that must convert text to speech or braille output.

Also note that browsers differ in how they handle cases of omitted alternate text.

Example

The below code shows how to declaratively set the Alt property of an HtmlImage control at design time.

<img src="~/shared/aspxtreme.jpg" width=100 height=30 border=0 
   alt="Simply awesome" align="right" runat="server" />
See Also

HtmlImage Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph