input min max - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Introduction

You use the min and max attributes to ensure that numeric and date values are within a specific range.

The following code shows these attributes applied to the number type of the input element.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <title>Example</title> 
   </head> 
   <body> 
      <form method="post" action="http://example.com/form"> 
         <input type="hidden" name="recordID" value="1234"> 
         <p> 
            <label for="name">
                Name: <!--  w  w  w .j a v  a  2  s .  com-->
               <input type="text" id="name" name="name"> 
            </label> 
         </p> 
         <p> 
            <label for="password">
                Password: 
               <input type="password" placeholder="Min 6 characters" id="password" name="password"> 
            </label> 
         </p> 
         <p> 
            <label for="price">
                $ per unit in your area: 
               <input type="number" min="0" max="100" value="1" id="price" name="price"> 
            </label> 
         </p> 
         <input type="submit" value="Submit"> 
      </form>  
   </body>
</html>

Related Tutorials