html tutorial - step Attribute in HTML - html5 - html code - html form

Step attribute in html

Learn html - html tutorial - Step attribute in html - html examples - html programs

  • The step attribute defines the legal number intervals for an <input> tag.
  • For example if step=5, the legal number intervals could be -5, 0, 5, 10, 15, etc.

Syntax for step attribute in HTML:

<input step="number">

Differences between HTML 4.01 and HTML5 for step attribute:

HTML 4.01

  • HTML4 does not support step attribute.


  • The step attribute is new in HTML5.

Applies To:

Element Attribute
<input> step

Attribute Values:

Value Description
number Describes the legal number intervals for an input field.

Sample Coding for step Attribute in HTML:

Tryit<!DOCTYPE html>
    <title>Wikitechy step attribute</title>
    <form action="step.html">
    <input type="number" name="point" step="5">
    <input type="submit">

Code Explanation for step Attribute in HTML:

step Attribute Code Explanation

  1. <form> tag is used to design a form for user input.
  2. <input> tag is used to getting the number from the user.
  3. type attribute defines the type of element (The value is number)
  4. name attribute defines the name of the element.
  5. step attribute describes the legal number intervals for an input field.

Output for step Attribute in HTML:

step Attribute Tag Output

  1. The output shows that, if input as 9 then the step attribute displays a warning message as “please enter a valid value. The two nearest valid values are 5 and 10".
step Attribute Tag Output

  1. If input as 15 the step attribute accepts that value because 15 is a multiplication of step value 5.After click the submit button the result is shows in URL as point=15, because the form has been submitted.

Browser Support for step Attribute in HTML:

6.0 10.0 16.0 5.0 10.6

Tips and Notes

  • The step attribute may be used together with the max and min attributes to create a range of legal values.
  • The step attribute works with the following input types: number, range, date, datetime, datetime-local, month, time and week.

Related Searches to step Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.