ASP.NET HorizontalAlign Property

Definition and Usage

The HorizontalAlign property is used to set or return the horizontal alignment of the content within the Panel control.

Syntax

<asp:Panel HorizontalAlign="align" runat="server">
Some Content
</asp:Panel>
Property Description
align

Specify the horizontal alignment of the content.

Possible Values:

  • Center
  • Justify
  • Left
  • NotSet (Default)
  • Right

Example

The following example sets the HorizontalAlign property of the Panel control:

<form runat="server">
<asp:Panel id="pan1" runat="server"> HorizontalAlign="Center" >
Hello!
</asp:Panel>
</form>

Example

Set Horizontal Alignment for Panel Control