Course Recommendations:

HTML <input> min Attribute

min Definition and Usage

The attribute specifies the minimum value of the <input> element.Hint: the max attribute With min When used together, the attributes can create a range of valid values.

Note:max and min The attributes apply to the following input types:

  • number
  • range
  • date
  • datetime-local
  • month
  • time
  • week

Example

Using the min and max attributes:

<form action="/action_page.php">
  <label for="datemax">Please enter a date before January 1, 1980:</label>
  <input type="date" id="datemax" name="datemax" max="1979-12-31"><br><br>
  <label for="datemin">Please enter a date after January 1, 2000:</label>
  <input type="date" id="datemin" name="datemin" min="2000-01-02"><br><br>
  <label for="quantity">Please enter the quantity (between 1 and 5):</label>
  <input type="number" id="quantity" name="quantity" min="1" max="5"><br><br>
  <input type="submit">
</form>

Try It Yourself

Syntax

<input min="number|date">

Attribute Value

Value Description
number Specify the minimum allowed value.
date Specify the latest allowed date.

Browser Support

The numbers in the table indicate the first browser version to fully support this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
5.0 10.0 16.0 5.1 10.6