HTML step attribute

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

Example

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

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.

step attribute values

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

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

Related Pages

You can visit min and max attributes for the range of values.

type attribute represents the type of data in the input control.



Was this article helpful?

 

Email:

Message:

Get the newsletter