CKTIS / HTML
max — upper value bound
The max attribute sets the upper bound for selected input types, a meter scale, or task progress. Its value format, defaults, and the consequences of exceeding the bound depend on the element.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
input: max="upper-bound"; meter: max="number"; progress: max="positive-number"max sets an upper bound, not a text length limit — that is the role of maxlength. On input, it applies to number, range, date, month, week, time, and datetime-local. Its value must match the type's format, such as 10, 2026-12-31, or 18:00.
For an ordinary range, a value above the maximum causes validity.rangeOverflow. max does not guarantee that entering such a value is prevented. An absent or invalid value means no maximum unless the type defines a default: range defaults to 100 and clamps its value to the range. Normally, max must not be less than min; time is an exception, allowing a reversed range across midnight.
On meter, the attribute defines the end of a measurement scale and must be a valid floating-point number no smaller than min. The browser uses a fallback maximum of 1 when the attribute is absent or cannot be parsed, raising the effective maximum to the minimum if necessary.
On progress, max means the total amount of work and must be a valid number greater than zero. An absent or invalid value gives a maximum of 1. Omitting value makes progress indeterminate even when max is set. Use meter for measurements and progress for task completion.
Examples
<!doctype html>
<meta charset="utf-8">
<title>max</title>
<label>Input: <input id="quantity" type="number" max="10" value="11"></label>
<label>Meter: <meter id="gauge" min="0" max="10" value="7">7/10</meter></label>
<label>Progress: <progress id="task" max="10" value="7">7/10</progress></label>
<pre id="result"></pre>
<script>
const quantity = document.getElementById('quantity');
const gauge = document.getElementById('gauge');
const task = document.getElementById('task');
document.getElementById('result').textContent = [
`rangeOverflow: ${quantity.validity.rangeOverflow}`,
`meter max: ${gauge.max}`,
`progress position: ${task.position}`
].join('\n');
</script>Result
rangeOverflow: true meter max: 10 progress position: 0.7
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.