Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q2075 How can I right align text in an input box?

You are here: irt.org | FAQ | HTML | Q2075 [ previous next ]

Simply include the text-align CSS property as part of your INPUT tag, e.g.

<INPUT TYPE=TEXT STYLE="text-align:right">

Jukka Korpela comments:

This really does the job on IE 4+, but it right-aligns the whole input box on Netscape 4. (And naturally fails to have any effect on many browsers, but that's implied by saying it's a CSS thing.)

After a short Usenet discussion last March (with initial article http://www.deja.com/=dnc/[ST_rn=ps]/getdoc.xp?AN=451268119) I think I now see why people wish to right-align text in input boxes, but it seems that there is no recommendable solution at present even under the usual CSS caveats, since causing an undesired effect on Netscape is a rather high price to pay for desired effect on IE. I tried fixing the Netscape problem by slapping <div align="left"> and </div> around the INPUT element, but Netscape still right aligns the box itself (and text alignment inside it is normal left align).

Feedback on 'Q2075 How can I right align text in an input box?'

©2018 Martin Webb