样式化 HTML5 输入类型编号 [英] Styling HTML5 input type number
本文介绍了样式化 HTML5 输入类型编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在用 HTML5 编写表单.输入之一是type=number
.我希望输入只显示 2 位数字,但它似乎默认显示至少 5 位数字,这会占用额外的空间.我试过添加 size="2"
属性,但没有效果.
I'm writing a form in HTML5. One of the inputs is type=number
. I want the input to only show 2 digits but it seems to default to showing at least 5 digits, which takes up extra space. I've tried adding size="2"
attribute, with no effect.
这是我使用的标签:
<input type="number" name="numericInput" size="2" min="0" max="18" value="0" />
我错过了什么?
推荐答案
HTML5 数字输入没有宽度或大小等样式属性,但您可以使用 CSS 轻松设置样式.
HTML5 number input doesn't have styles attributes like width or size, but you can style it easily with CSS.
input[type="number"] {
width:50px;
}
这篇关于样式化 HTML5 输入类型编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文