Home  >  Article  >  Web Front-end  >  How can we include legal number ranges for input fields in HTML?

How can we include legal number ranges for input fields in HTML?

WBOY
WBOYforward
2023-08-31 22:09:151307browse

How can we include legal number ranges for input fields in HTML?

Use the step attribute to include legal numeric intervals for input fields in HTML. The HTML input type step attribute sets the legal number interval. Steps are numerical steps, such as 0, 5, 10, 15, 20, etc. The step attribute can be used with the max and min attributes to create legal range values.

Example

You can try running the following code to implement StepsProperties -

<!DOCTYPE html>
<html>
   <head>
      <title>HTML input step attribute</title>
   </head>
   <body>
      <form action = "" method = "get">
         <input type = "number" name = "points" step = "5"><br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>

The above is the detailed content of How can we include legal number ranges for input fields in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete