如何更改输入文本框的大小? [英] How to change the size of the input text box?
本文介绍了如何更改输入文本框的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改类型文本输入的框大小
How can i change the box size of the input of type text
<input type="text" id="text" name="text_name" />
我可以通过编辑css吗?
Can i do that with editing css ?
推荐答案
您可以设置 width
:
<input type="text" id="text" name="text_name" style="width: 300px;" />
或更好地定义一个类:
<input type="text" id="text" name="text_name" class="mytext" />
并在单独的CSS文件中应用必要的样式:
and in a separate CSS file apply the necessary styling:
.mytext {
width: 300px;
}
如果要限制用户可以键入的字符数textbox你可以使用 maxlength
属性:
If you want to limit the number of characters that the user can type into this textbox you could use the maxlength
attribute:
<input type="text" id="text" name="text_name" class="mytext" maxlength="25" />
这篇关于如何更改输入文本框的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文