[thelist] JS Question - Right align text in input box??
Aylard JA (James)
jaylard at equilon.com
Wed Oct 18 19:16:59 CDT 2000
Shoshannah,
> dir=rtl should do it for IE 4+
I recommend against doing this for two reasons:
1) It uses the "dir" attribute for a purpose not intended by the W3C spec
(which is to specify the directionality of text for languages that read
right-to-left, not to display left-to-right text as flush-right).
2) IE can do some strange things to the result. For example:
<input type="text"
value="Watch me!"
dir="rtl">
IE displays the result as: "!Watch me". A bug? Probably. But then, English
isn't meant to be interpreted in right-to-left fashion.
Use the standards-compliant approach:
<input type="text"
value="Watch me!"
style="text-align: right;">
As long as you realize that Netscape 4 (and IE3) will shift the
entire input element to the right, and account for that as necessary.
James Aylard
More information about the thelist
mailing list