我有一个带有短maxlength但长value属性的HTML标签。 我想要显示的文本显示文本的结尾(右侧),而不是开始(左侧)。
<input maxlength=10 value="A really really really long entry goes in here"/>
目前显示为:
"A really r"
我希望它显示为:
"es in here"
Cheers,
Ian
我有一个带有短maxlength但长value属性的HTML标签。 我想要显示的文本显示文本的结尾(右侧),而不是开始(左侧)。
<input maxlength=10 value="A really really really long entry goes in here"/>
目前显示为:
"A really r"
我希望它显示为:
"es in here"
Cheers,
Ian
您想让可见区域从右侧开始吗? 您可以使用CSS和以下规则:input {direction:rtl;}
rtl
表示从右到左。
注意:在您的HTML中,maxlength
的值必须用引号括起来,并且您还必须设置 input
的 type
属性。
将style="text-align:right"
添加到输入标签。
.contenedor{
width: 100px;
background-color: black;
color: white;
border-radius: 5px;
display: flex;
justify-content: flex-end;
overflow:hidden;
padding: 5px;
}
<div class="contenedor"><span>12345555555566final</span></div>