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:

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


Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

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