Change
Change

Reputation: 438

how to align asp.net label text in center

I have a label with in a div in ASP.NET just before a text box but I am not sure how can I center align my asp.net label,

    <div style="float: left; width: 65%;">
        <asp:Label ID="lba" CssClass="aa" runat="server" Text="aaa" />
    </div>

Upvotes: 4

Views: 34977

Answers (3)

Chintan Gandhi
Chintan Gandhi

Reputation: 19

<div style="text-align:center; width:100%;"> 
  <asp:Lable ID="lba" style="margin:0 auto;" CssClass="aa" runat="server"/>
</div>

you can also try style="margin:0 auto;" to label and width 100% to parend div.

Upvotes: 0

Xavier
Xavier

Reputation: 1794

<div style="float: left; width: 65%; text-align: center;">
      <asp:Label ID="lba" CssClass="aa" runat="server" Text="aaa" />
    </div>

Upvotes: 2

Muthu Kumaran
Muthu Kumaran

Reputation: 17910

In the div element add style text-align: center to center the text

<div style="float: left; width: 65%; text-align: center;">

Upvotes: 11

Related Questions