Compartilhar via


HtmlImage.Alt Propriedade

Definição

Obtém ou define a legenda alternativa que o navegador exibe se uma imagem não está disponível ou está sendo baixada no momento, sem que o download tenha sido concluído.

public:
 property System::String ^ Alt { System::String ^ get(); void set(System::String ^ value); };
public string Alt { get; set; }
member this.Alt : string with get, set
Public Property Alt As String

Valor da propriedade

String

Uma cadeia de caracteres que contém a legenda alternativa para o navegador usar quando a imagem não estiver disponível.

Exemplos

O exemplo de código a Src seguir demonstra como usar a Alt propriedade para especificar a legenda a ser exibida quando a imagem especificada pela propriedade não estiver disponível.

<%@ Page Language="C#" AutoEventWireup="True" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
 <head>
    <title>HtmlImage Example</title>
</head>
 
 <body>
 
    <form id="form1" runat="server">
 
       <h3>HtmlImage Example</h3>
     
       <img id ="Image1"
            src="Image1.jpg"
            alt="Image 1"
            runat="server"
            style="width:500; height:226; border:5; text-align:center" />
    
    </form>
 
 </body>
 </html>
<%@ Page Language="VB" AutoEventWireup="True" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
 <head>
    <title>HtmlImage Example</title>
</head>
 
 <body>
 
    <form id="form1" runat="server">
 
       <h3>HtmlImage Example</h3>
     
       <img id ="Image1"
            src="Image1.jpg"
            alt="Image 1"
            runat="server"
            style="width:500; height:226; border:5; text-align:center" />
    
    </form>
 
 </body>
 </html>

Comentários

Use essa propriedade para especificar a legenda exibida quando a imagem especificada pela Src propriedade não estiver disponível. Em navegadores mais recentes, essa legenda também aparece como uma Dica de Ferramenta.

Aplica-se a

Confira também