HTML attribute: max - HTML | MDN (original) (raw)

Syntax

Syntax formax values by inputtype

Input type Syntax Example
date yyyy-mm-dd
month yyyy-mm
week yyyy-W##
time HH:mm
datetime-local yyyy-mm-ddTHH:mm
number
range

**Note:**When the data entered by the user doesn't adhere to the maximum value set, the value is considered invalid in constraint validation and will match the :invalid and :out-of-range pseudo-classes.

See Client-side validation and rangeOverflow for more information.

For the element, the max attribute describes how much work the task indicated by the progress element requires. If present, must have a value greater than zero and be a valid floating point number. For the element, the max attribute defines the upper numeric bound of the measured range. This must be greater than the minimum value (min attribute), if specified. In both cases, if omitted, the value defaults to 1.

Syntax formax values for other elements

Input type Syntax Example
70%
at 40/100

Accessibility concerns

Provide instructions to help users understand how to complete the form and use individual form controls. Indicate any required and optional input, data formats, and other relevant information. When using the max attribute, ensure this maximum requirement is understood by the user. Providing instructions within the may be sufficient. If providing instructions outside of labels, which allows more flexible positioning and design, consider using aria-labelledby or aria-describedby.

Specifications

Specification
HTML # attr-input-max
HTML # attr-meter-max
HTML # attr-progress-max

Browser compatibility

html.elements.input.max

html.elements.meter.max

html.elements.progress.max

See also