HTML Forms: Total Domination
Sobre a Aula

This attribute is used to determine the acceptable increments between allowed numerical values. For example, if the “step” is set to “3”, the allowed numbers will be multiples of 3, such as -3, 0, 3, 6, and so on.

Combining the “step” attribute with the “max” and “min” attributes enables the creation of specific value ranges.

This is particularly useful when one wants to restrict user input to values that meet certain criteria, such as dates, times, or numbers within a specific range.

The “step” attribute is applicable to various input types, including number, range, date, local date/time, month, time, and week.

<form>
  <label for="points">Points:</label>
  <input type="number" id="points" name="points" step="3">
</form>

Integrating this attribute into numerical fields provides developers with an effective way to control and validate the data entered by users.

Entrar na conversa
Rolar para cima