Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | HTML | Q2075 [ previous next ]

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

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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.