html5 min max,HTML5 Forms

Live Demo

The Low Down

661afdbd3edc3a2312b53ca2d2031c74.png

Firefox

16+

9f2c958084d4db5a4968e772b2c961d5.png021ef095872b75da9c16097fef915850.png

Safari

5+

9f2c958084d4db5a4968e772b2c961d5.pngd8fd9b8734efd202dc665daaeceab0a5.png

Safari Mobile

3.2+

9f2c958084d4db5a4968e772b2c961d5.png732c520d16c0a207ab4c52d549cf2b7a.png

Chrome

6+

9f2c958084d4db5a4968e772b2c961d5.pngb57f6284598227da9f9a7ddb39f54136.png

Opera

10.6+

9f2c958084d4db5a4968e772b2c961d5.png3d7e9555f826dbd79467721504f46999.png

IE

10+

9f2c958084d4db5a4968e772b2c961d5.pngeddd81cc3db238d58ce57febfff6253d.png

Android

4.0+

9f2c958084d4db5a4968e772b2c961d5.png

To use the min, max, and step attributes the input first needs a type of number, range or one of the date/time values. In the case of type=”number”, small arrow widgets are applied after the input which increment the current value of the input up or down. In the case of type=”range”, the possible values of the slider GUI presented in supporting browsers will range from the min to the max value, incrementing by the value of the step attribute.

You don’t need to use all three. Each works independently with default values being set for step if the attribute is not explicitly included.

If step is not explicitly included, the value of step defaults to 1, as if it were included with step=”1″ (or step=”60″ in the case of type=”time”), even if the default value or min value is a float.

To allow any float value, include the value of any on the step attribute, with step=”any”.

min and max imply validation of that value.

When max and step are set, Chrome may display a narrower input box for number input type, as the length of the largest valid value is limited.

The Up/Down GUI spinner widget takes space from total width of input (Chrome 10 tested).

If no value is set, the default value of range is half way between the min and max values. Number will generally default to 0 when the GUI is first interacted with if no value is set.

While IE10 and IE11, Android and iOS don’t support the GUI of the Number input type, they do support min, max, and step in terms of validation constraints.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值