Compartir por


HtmlImage.Align Propiedad

Definición

Obtiene o establece la alineación de la imagen en relación con otros elementos de página web.

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

Valor de propiedad

Cadena que especifica la alineación de la imagen con respecto a otros elementos de página web.

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar la Align propiedad para especificar la alineación de una imagen en una página web.

<%@ 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>

En el ejemplo de código siguiente se muestra cómo centrar una imagen en la página web ajustando el HtmlImage control dentro de las etiquetas de párrafo con el align atributo establecido "center"en .

<%@ 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>
 
       <p style="text-align:center">
     
       <img id ="Image1"
            src="Image1.jpg"
            alt="Image 1"
            runat="server"
            style="width:500; height:226; border:5; text-align:center" />
 
       </p>
 
    </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>
 
       <p style="text-align:center">
     
       <img id ="Image1"
            src="Image1.jpg"
            alt="Image 1"
            runat="server"
            style="width:500; height:226; border:5; text-align:center" />
 
       </p>
 
    </form>
 
 </body>
 </html>

Comentarios

Utilice esta propiedad para especificar la alineación de la imagen con respecto a otros elementos de la página web.

En la tabla siguiente se representan los valores posibles.

Importancia Descripción
izquierda La imagen se alinea en el lado izquierdo de la página web.
centro La imagen se alinea en el centro de la página web.
Derecha La imagen se alinea en el lado derecho de la página web.
top Otros elementos de la página web se alinean con el borde superior de la imagen.
Medio Otros elementos de la página web se alinean con el centro de la imagen.
inferior Otros elementos de la página web se alinean con el borde inferior de la imagen.

Nota:

Es posible que el valor central no funcione en todos los exploradores. Para centrar una imagen, ajuste el HtmlImage control dentro de las etiquetas de párrafo que contienen el align atributo establecido "center" en (<p align= "center">).

Se aplica a