Latest web development tutorials

HTML input step attributes

HTML input Tag Reference HTML <input> tag

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>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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 Reference HTML <input> tag