Thuộc tính min và max đặt giá trị nhỏ nhất/lớn nhất cho phần tử. Áp dụng cho:
| Phần tử | min | max |
|---|---|---|
<input> (number, range, date, time, datetime-local, month, week) | ✓ | ✓ |
<meter> | ✓ | ✓ |
<progress> | ✓ | ✓ |
Ví dụ: Input number 1–20
<!DOCTYPE html>
<html>
<head>
<title>HTML min and max attribute</title>
</head>
<body>
<form action="" method="get">
Nhập số 1 đến 20: <input type="number" name="num" min="1" max="20"><br>
<input type="submit" value="Gửi">
</form>
</body>
</html>
Lưu ý: <meter> hiển thị thang đo (disk usage, vote...), <progress> hiển thị tiến trình. Cả hai cần min/max.