造型HTML5输入类型编号 [英] Styling HTML5 input type number

查看:120
本文介绍了造型HTML5输入类型编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用HTML5编写一个表单。其中一个输入是 type = number 。我希望输入只显示2位数,但它似乎默认显示至少5位数,这占用了额外的空间。我已经尝试添加 size =2属性,但是没有任何作用。

使用:

 < input type =numbername =numericInputsize =2min =0max =18value =0/> 

我缺少什么?

解决方案

HTML5数字输入没有像宽度或大小这样的样式属性,但您可以使用CSS轻松设计样式。

 输入[type =number] {
宽度:50px;
}


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.

This the tag i'm using:

<input type="number" name="numericInput" size="2" min="0" max="18" value="0" />

What am I missing?

解决方案

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屋!

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