HTML min Attribute


The min attribute in HTML is used to set the minimum value of an element. You can use it in <meter> as well as <input> element.

Example

Let us first see an example of the min attribute of the <meter> element −

 Live Demo

<!DOCTYPE html>
<html>
<body>
<h2>Water Levels</h2>
<p>Impurity Level <meter min="0" low="50" high="95" max="100" value="85"></meter></p>
<p>TDS Level <meter min="0" low="20" high="80" max="100" value="60"></meter></p>
</body>
</html>

Output

This will produce the following output −

Example

Now, we will see an example of min attribute in <input> element −

 Live Demo

<!DOCTYPE html>
<html>
<body>
<h2>Player Details with Reporting Time</h2>
<form>
<p>These are the <ins>details with <ins>reporting date</ins>:</p>
<fieldset>
<legend>New Details:</legend>
Cricketer: <input type="text"><br>
Rank: <input type="number"><br>
Email: <input type="email"><br>
Reporting Date:<input type="date" name="reporting" min="2019-05-05">
</fieldset>
</form>
</body>
</html>

Output

This will produce the following output −

Now, if you will try to add a date before the 2018-05-05, then the following will be visible −

Updated on: 17-Sep-2019

79 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements