max 属性指定元素的最大值。
当被 <progress> 元素使用时,max 属性指定任务总共需要多少工作。
max 属性可用于以下元素:
| 元素 Element | 属性 Attribute |
|---|---|
| <input> | max |
| <meter> | max |
| <progress> | max |
使用 min 和 max 属性:
<form action="/action_page.php"> Enter a date before 1980-01-01: <input type="date" name="bday" max="1979-12-31"><br/> Enter a date after 2000-01-01: <input type="date" name="bday" min="2000-01-02"><br/> Quantity (between 1 and 5): <input type="number" name="quantity" min="1" max="5"><br/> <input type="submit"> </form>
具有当前值和最小min、最大、高和低段的仪表:
<meter min="0" low="40" high="90" max="100" value="95"></meter>
正在下载:
<progress value="22" max="100"></progress>
max 属性对每个元素都有以下浏览器支持:
| 元素 Element |
|
|
|
|
|
|---|---|---|---|---|---|
| <input> | 5.0 | 10.0 | 16.0 | 5.1 | 10.6 |
| <meter> | 8.0 | ❌ 不支持 | 6.0 | 6.0 | 11.0 |
| <progress> | 8.0 | 10.0 | 16.0 | 6.0 | 11.0 |