右对齐HTML输入字段中的文本 [英] Right align text in HTML input field

查看:143
本文介绍了右对齐HTML输入字段中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML标记,它有一个短的最大长度,但长的属性值。我希望显示的文本显示文本的结束(右侧),而不是开头(左侧)。

 < input maxlength = 10 value =真的真的很长的条目在这里/> 

目前显示:



r



,而我希望它显示:



干杯,



Ian

解决方案>

您要让可见区域从右边开始吗?您可以使用css和以下规则 input {direction:rtl;}



rtl 表示从右到左



示例: http:// jsbin .com / ilejo4



PS:您的HTML中的 maxlength 的值必须用引号,您还必须设置输入的类型


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

解决方案

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

这篇关于右对齐HTML输入字段中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆