Home > Web Front-end > HTML Tutorial > 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
Release: 2023-08-31 22:09:15
forward
1344 people have browsed it

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>
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template