HTML input step attributes
Examples
HTML form with the specified legitimate digital input fields spaced:
<form action="demo_form.html">
<input type="number" name="points" step="3">
<input type="submit">
</form>
<input type="number" name="points" step="3">
<input type="submit">
</form>
try it"
Browser Support
Internet Explorer 10, Opera, Chrome and Safari support step attributes.
Note: Firefox or Internet Explorer 9 and earlier versions do not support the step attribute <input> tag.
Definition and Usage
step attribute specifies the legal digital <input> element interval.
Example: if the step = "3", then it should be -3,0,3,6 legitimate digital, and so on.
Tip: step attribute can be used with max and min attributes used in conjunction to create a range of legal values.
Note: step attribute applies to the following types of input: number, range, date, datetime , datetime-local, month, time and week.
Differences between HTML 4.01 and HTML5
step attribute is new in HTML5 attributes.
grammar
<input step=" number ">
Property Value
值 | 描述 |
---|---|
number | 规定输入字段的合法数字间隔。 |
HTML <input> tag