HTML step attribute

step attribute increments or decrements a specific value by limiting the allowed values.

<p>Percentage: <input type="number" min="0" max="100" step="1">
<p>GPA:<input type="number" min="0" max="4" step="0.1"></p>
</>

Percentage:

GPA:

One input field contains '1' value for the step attribute. It represents that the value increases or decreases by 1.

The other input control contains '0.1' value of step attribute. It indicates the increment or decrement by 0.1.

After the maximum allowed value, the value is not incremented by the input control.

Attribute values

All possible values of step attribute

The value of step attribute is a valid positive floating point number.

any string may be the value of step attribute. By default, the default step value is 1.

Related Tags

The tags that support step attribute

<input> element allows the user to enter data in the form. This element is used in the form element. It supports the step attribute.



Was this article helpful?

 

Email:

Message: