Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set alignment center in TextBox in ASP.NET?

How to set align center for an <asp:TextBox> control in an ASP.NET Web Application?

like image 703
Student Avatar asked Feb 10 '11 21:02

Student


People also ask

How do I center align a TextBox?

Right-click the text box for which you want to set vertical alignment. On the shortcut menu, click Format Text Box. In the Format Text Box dialog box, click the Text Box tab. In the Vertical alignment box, select Top, Middle, or Bottom.

How do I align a TextBox to the right?

text-align:right; will only right align text elements. It appears that your are using bootstrap. You could try giving your form a class of pull-right , which is a bootstrap class for float right.


1 Answers

Add the css styling text-align: center to the control.

Ideally you would do this through a css class assigned to the control, but if you must do it directly, here is an example:

<asp:TextBox ID="myTextBox" runat="server" style="text-align: center"></asp:TextBox> 
like image 162
JohnFx Avatar answered Sep 19 '22 05:09

JohnFx