Is there a float input type in HTML5?

前端 未结 9 2004
失恋的感觉
失恋的感觉 2020-11-22 11:32

According to html5.org, the \"number\" input type\'s \"value attribute, if specified and not empty, must have a value that is a valid floating point number.\"

Yet it

9条回答
  •  鱼传尺愫
    2020-11-22 12:20

    You can use the step attribute to the input type number:

    
    

    step="any" will allow any decimal.
    step="1" will allow no decimal.
    step="0.5" will allow 0.5; 1; 1.5; ...
    step="0.1" will allow 0.1; 0.2; 0.3; 0.4; ...

提交回复
热议问题