你如何匹配一个文本输入框的大小和最大长度?(How do you match up the size

2019-07-19 03:27发布

你如何匹配一个文本输入框的大小和最大长度? 该最大长度和大小属性不排队,并且依赖于该字体的使用是非常烦人。

 Example input:<input type="text" size="4" maxlength="4" />

有什么建议?

Answer 1:

我不认为它会匹配起来,这将非常依赖于浏览器。 最好的办法是使用CSS来设置输入的宽度。

<input type="text" maxlength="4" value="1234" />

input {width:30px;}

http://jsfiddle.net/BqEsd/67/

你也能想出某种功能,它的大小以关闭字符,字体大小和语言。 事情是这样的,例如..

例:

http://jsfiddle.net/krishollenbeck/ohpy5L95/3/



文章来源: How do you match up the size and maxlength of a text input box?
标签: html css forms