Right align text in HTML input field
-
12-11-2019 - |
Frage
I have an HTML tag with a short maxlength but a long value attribute. I'd like the displayed text to show the end (right side) of the text, rather than the start (left side).
<input maxlength=10 value="A really really really long entry goes in here"/>
currently shows:
"A really r"
instead I'd like it to show:
"es in here"
Cheers,
Ian
Lösung
Do you want the visible area to start from the right? you can use css and the following rule input {direction:rtl;}
rtl
means from right to left
example: http://jsbin.com/ilejo4
PS: the value of maxlength
in your html must be wrapped with quotes, also you have to set the type
of the input
Andere Tipps
Add style="text-align:right"
to the input tag.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow