Link to home
Create AccountLog in
Avatar of jwright9
jwright9

asked on

Is there a way using CSS to align the text in a html text input?

Is there a way using CSS to align the text in a html text input?  The align attribute is deprecated.  What CSS rule syntax would I use to align the input text in a html input text edit?
ASKER CERTIFIED SOLUTION
Avatar of MikeQc
MikeQc
Flag of Canada image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
<input type="text" name="FirstName" value="hi" style="{text-align:center;}" />
it's better (from accessibility point of view) to use LABEL element and apply float:left styling to it like this:

<label for="someInput" style="float: left">Some Text</label>
<input type="text" id="someInput" name="someInput" value="someValue" size="10" />
<p style="clear:both"></p>

the P element clears the left alignment, so any further elements will fall below the label+input, not to the lest of it

hope this helps ;-)
whoops... disregard my answer please, I've misread the question :-D
Avatar of jwright9
jwright9

ASKER

To solve this I actually used something like this inline style:

style="padding-top: 2px;"