HTML max Attribute

❮ HTML Attributes

Example

<form action="action.php">
<label for="date">Enter a date between (2020-01-01 - 2021-01-01):</label>
<input type="date" id="date" name="date" min="2020-01-01" max="2021-01-01"><br><br>

<label for="quantity">Quantity (between 1 and 10):</label>
<input type="number" id="quantity" name="quantity" min="0" max="10"><br><br>

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

Meaning

The max attribute should be set to a numeric value that is the high range allowed in the form control.




Standard Syntax

<element value="number" max="number">



Browser Support




Status




Applies to:

The max attribute can be used on the following element:

Element Attribute
<input> max
<meter> max
<progess> max






Attribute Values

Value Description
number Specifies the maximum value allowed.



More Examples

<meter> Example

<p><label for="a">A score:</label>
<meter id="a" min="0" low="40" high="90" max="100" value="60"></meter></p>

<p><label for="b">B score:</label>
<meter id="b" min="0" low="40" high="90" max="100" value="85"></meter></p>



<progress> Example

<label for="loading">Loading progress:</label>
<progress id="loading" value="55" max="100"> 55% </progress>
❮ HTML Attributes