HTML max attribute

HTML max attribute gives the maximum value in input field. It means value cannot exceed the maximum value in the input element.

<p>Volume (cubic centimeter): <input type="number" min="0" max="100" step="1"></p>
 <p>Diameter (cm):<input type="number" min="0" max="4" step="0.09"></p>
</>

Volume (cubic centimeter):

Diameter (cm):

Attribute values

All possible values of max attribute

The value is valid floating point number.

Related Tags

The tags that support max attribute

<input> tag

input element represents input control in a form. If the value that is greater than max value the form will not be submitted .

<input type="number" min="0" max="10">
Try</>

<meter> tag

meter tag represents the completion of a task in the form of a bar for known range value. For instance, the completion of charging of a battery.

<meter value="250" min="10" max="1000"> </meter>
Try</>

<progress> tag

progress element represents the completion of a task in the form of progress bar.

<progress value="310" max="1000"> </progress>
Try</>


Was this article helpful?