Center text in Web Server TextBox control

D

David K.

Hi,
I wonder how can I center a text in a Web Server TextBox control (or
even Label control).
Same question for an HTML Server TextBox control.
Any help will be appreciated.

Tkanks,
David
 
J

jennifer1970

David,

This worked for a label... it will probably work for a text box too,
but I'm not for sure. I have this in my Page_Load event.

Label1.Style.Add("Text-Align", "center")


HTH,
Jennifer
 
O

Oscar Onorato

You can use an css external file to configure that.
Inside of your input text you must create one atribute class with the name of class in the css file.
Inside of css file, by VS.NET, you easily can edit theirs styles, without write nothing in the input element except the class (css) definition.
In this case, the class definition may be:



<INPUT class="txtLugares" id="txtLugares1" type="text" maxLength="2" size="1" name="txtLugares1">

and, in the css file:


..txtLugares
{
text-align:center; /* that is, i believe wath you nedd */
font-size:xx-small;
font-family:Verdana;
}

Note: for call to css file from webForm or HTML file, must insert (only by dragging the file css) a reference like this:

<LINK href="../css/nameOfFile.css" type="text/css" rel="stylesheet">

in this case, /css/ is the folder for this file.

I hope, was help you.

Sorry my english.

<[email protected]> escribió en el mensaje David,

This worked for a label... it will probably work for a text box too,
but I'm not for sure. I have this in my Page_Load event.

Label1.Style.Add("Text-Align", "center")


HTH,
Jennifer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top