右键对齐HTML输入字段中的文本

时间:2022-08-22 12:11:16

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).

我有一个HTML标签,其中包含一个短的maxlength但是一个long值属性。我希望显示的文本显示文本的结尾(右侧),而不是开头(左侧)。

<input maxlength=10 value="A really really really long entry goes in here"/>

currently shows:

"A really r"

“一个真正的r”

instead I'd like it to show:

相反,我希望它显示:

"es in here"

“在这里”

Cheers,

Ian

1 个解决方案

#1


17  

Do you want the visible area to start from the right? you can use css and the following rule input {direction:rtl;}

你想让可见区域从右边开始吗?你可以使用css和以下规则输入{direction:rtl;}

rtl means from right to left

rtl意味着从右到左

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

PS:你的html中maxlength的值必须用引号括起来,你也必须设置输入的类型

#1


17  

Do you want the visible area to start from the right? you can use css and the following rule input {direction:rtl;}

你想让可见区域从右边开始吗?你可以使用css和以下规则输入{direction:rtl;}

rtl means from right to left

rtl意味着从右到左

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

PS:你的html中maxlength的值必须用引号括起来,你也必须设置输入的类型