input min Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

The min attribute specifies the minimum value for an <input> element.

The max and min attributes works with the following input types: number, range, date, datetime, datetime-local, month, time and week.

Attribute Values

Value Description
number Specifies the minimum value allowed
date Specifies the minimum date allowed

The following code shows how to Use of the min and max attributes:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  Enter a date before 1980-01-01:
  <input type="date" name="bday" max="1979-12-31"><br>

  Enter a date after 2000-01-01:
  <input type="date" name="bday" min="2000-01-02"><br>

  Quantity (between 1 and 5):<!--  w w  w  .j  a  va 2  s.  c  om-->
  <input type="number" name="quantity" min="1" max="5"><br>

  <input type="submit">
</form>

</body>
</html>

Related Tutorials