input step Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

The step attribute specifies the legal number intervals for an <input> element.

Example: if step="3", legal numbers could be -3, 0, 3, 6, etc.

The step attribute can 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.

Attribute Values

Value Description
number Specifies the legal number intervals for the input field. Default is 1

An HTML form with an input field with a specified legal number intervals:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  <input type="number" name="points" step="3">
  <input type="submit">
</form><!-- w  ww  . ja  v  a2 s. c om-->

</body>
</html>

Related Tutorials