How to use min and max attributes in HTML?

HTMLWeb DevelopmentFront End Technology

The min and max attributes in HTML are used to set the minimum and maximum value of an element. The min and max attribute can be used on the following elements:

S. No
Elements
Attribute
Attribute
1
<input>
Max
min
2
<meter>
Max
min
3
<progress>
Max
min


Example

You can try to run the following code to learn how to use the min and max attribute in HTML.

<!DOCTYPE html>
<html>
   <head>
      <title>HTML min and max attribute</title>
   </head>
   <body>
      <form action = "" method = "get">
         Mention any number between 1 to 20
         <input type = "number" name="num" min = "1" max = "20"><br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>
raja
Published on 24-Jan-2018 11:52:38
Advertisements