HorizontalAlign Property
Collapse the table of content
Expand the table of content

Table.HorizontalAlign Property

Gets or sets the horizontal alignment of the Table control on the page.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public virtual HorizontalAlign HorizontalAlign { get; set; }
<asp:Table HorizontalAlign="HorizontalAlign" />

Property Value

Type: System.Web.UI.WebControls.HorizontalAlign
One of the HorizontalAlign enumeration values. The default value is NotSet.

Use the HorizontalAlign property to specify the horizontal alignment of the Table control within the page. The following table lists the different horizontal alignment styles.

HorizontalAlign value



The horizontal alignment of the Table control has not been set.


The Table control is left justified on the page.


The Table control is centered on the page.


The Table control is right justified on the page.


The Table control is aligned with both the left and right margins of the page.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head2" runat="server">
    <title>Table - C# Example</title>
    <form id="form1" runat="server">

    <h3>Table - C# Example</h3>

    <asp:Table id="Table1" runat="server" 
      GridLines="Both" BackImageUrl="image1.gif" 
      HorizontalAlign="Center" CellSpacing="3" 
        <asp:TableCell>Row 0, Col 0</asp:TableCell>
        <asp:TableCell>Row 0, Col 1</asp:TableCell>
        <asp:TableCell>Row 1, Col 0</asp:TableCell>
        <asp:TableCell>Row 1, Col 1</asp:TableCell>


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2016 Microsoft