set textbox align center

Hi,

How can we set a textbox control to align center? The textbox is inside a table.

also for drop down list box

Thanks.
EdwardPeterAsked:
Who is Participating?
 
sansofturaConnect With a Mentor Commented:
In the textbox add style="text-align: center;"
<asp:TextBox id="TextBox1" style="text-align: center;" runat="server"></asp:TextBox>

If you want you can create a css class and then asign it to the textbox

HTML
====
<asp:TextBox id="TextBox1" CssClass="txtAlign" runat="server"></asp:TextBox>

CSS
===
.txtAlign
{
      text-align: center;
/*
Add other style for the textbox if you want.
*/
}
0
 
ayha1999Connect With a Mentor Commented:
Hi,

<tr>
<td align="middle"><asp:TextBox id="" ...</asp:TextBox></td>

hope this helps.

ayha
0
 
EdwardPeterAuthor Commented:
ayha1999,

My apology, align the text inside the textbox.

Thanks.
0
 
EdwardPeterAuthor Commented:
sansoftura,

style="text-align: center;"

Sadly doesn't work for drop down list box. is there another way?

Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.