HTML <input> minAttribute

HTML input 标签参考手册HTML <input> Tag

Examples

Using the min and max attributes:

<form action="demo-form.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):
<input type="number" name="quantity" min="1" max="5"><br>

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

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Opera, Chrome, and Safari support the min attribute.

Note:Firefox and Internet Explorer 9 and earlier versions do not support the min attribute of the <input> tag.

Note:Since Internet Explorer 10 does not support these input types, the min attribute will not apply to date and time in IE 10.


Definition and Usage

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

Tip:The min attribute, used in conjunction withmaxthe attribute, can create a range of legal values.

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


Differences Between HTML 4.01 and HTML5

The min attribute is a new attribute in HTML5.


Syntax

<input min="number|date">

Attribute Values

Value Description
number A number. Specifies the minimum value allowed for the input field.
date A date. Specifies the minimum value allowed for the input field.


HTML input 标签参考手册HTML <input> Tag Other Extensions