HTML step Attribute
Example
<form action="action.php">
<label for="qty">quantity:</label>
<input type="number" id="qty" name="qty" step="2">
<input type="submit">
</form>
Meaning
The step attribute defines the step in which values can take.
The step defaults to 1 for number and range.
In date/time input types, step is expressed in seconds, with the default step being 60 seconds. The step scale factor is 1000 (which converts the seconds to milliseconds, as used in other algorithms).
Example:
- if step="2", legal numbers could be -2, 0, 4, 6, etc.
- if step="3", legal numbers could be -3, 0, 3, 6, etc.
Standard Syntax
<element step="number">
Browser Support
Status
Applies to:
The step attribute can be used on the following element:
Attribute Values
Value | Description |
---|---|
number | Defines the interval between legal numbers in the input field. Default is 1. The value must be a positive number, integer or float or the special value any, which means no stepping is implied, and any value is allowed. |