|
1 |
| -max.md |
| 1 | +HTML max 属性 |
2 | 2 | ===
|
3 | 3 |
|
4 |
| -欢迎您编辑 <a target="__blank" href="https://github.com/jaywcjlove/html-tutorial/blob/main/docs/attribute/max.md">docs/attribute/max.md</a> 文件,共建 HTML Tutorial 文档。 |
| 4 | +## 定义和用法 |
| 5 | + |
| 6 | +`max` 属性指定元素的最大值。 |
| 7 | + |
| 8 | +当被 `<progress>` 元素使用时,`max` 属性指定任务总共需要多少工作。 |
| 9 | + |
| 10 | +## Applies to |
| 11 | + |
| 12 | +`max` 属性可用于以下元素: |
| 13 | + |
| 14 | +| 元素 Element | 属性 Attribute | |
| 15 | +| ----- | ----- | |
| 16 | +| [\<input>](../tags/input.md) | [max](../tags/input_max.md) | |
| 17 | +| [\<meter>](../tags/meter.md) | [max](../tags/meter_max.md) | |
| 18 | +| [\<progress>](../tags/progress.md) | [max](../tags/progress_max.md) | |
| 19 | + |
| 20 | +## 示例 |
| 21 | + |
| 22 | +使用 [min](./min.md) 和 max 属性: |
| 23 | + |
| 24 | +```html idoc:preview:iframe |
| 25 | +<form action="/action_page.php"> |
| 26 | + Enter a date before 1980-01-01: |
| 27 | + <input type="date" name="bday" max="1979-12-31"><br/> |
| 28 | + Enter a date after 2000-01-01: |
| 29 | + <input type="date" name="bday" min="2000-01-02"><br/> |
| 30 | + Quantity (between 1 and 5): |
| 31 | + <input type="number" name="quantity" min="1" max="5"><br/> |
| 32 | + <input type="submit"> |
| 33 | +</form> |
| 34 | +``` |
| 35 | + |
| 36 | +### Meter 示例 |
| 37 | + |
| 38 | +具有当前值和最小[min](./min.md)、最大、高和低段的仪表: |
| 39 | + |
| 40 | +```html idoc:preview:iframe |
| 41 | +<meter min="0" low="40" high="90" max="100" value="95"></meter> |
| 42 | +``` |
| 43 | + |
| 44 | +### Progress 示例 |
| 45 | + |
| 46 | +正在下载: |
| 47 | + |
| 48 | +```html idoc:preview:iframe |
| 49 | +<progress value="22" max="100"></progress> |
| 50 | +``` |
| 51 | + |
| 52 | +## 浏览器支持 |
| 53 | + |
| 54 | +`max` 属性对每个元素都有以下浏览器支持: |
| 55 | + |
| 56 | +| 元素 Element | ![chrome][1] | ![edge][2] | ![firefox][3] | ![safari][4] | ![opera][5] | |
| 57 | +| ------- | --- | --- | --- | --- | --- | |
| 58 | +| [\<input>](../tags/input.md) | 5.0 | 10.0 | 16.0 | 5.1 | 10.6 | |
| 59 | +| [\<meter>](../tags/meter.md) | 8.0 | ❌ 不支持 | 6.0 | 6.0 | 11.0 | |
| 60 | +| [\<progress>](../tags/progress.md) | 8.0 | 10.0 | 16.0 | 6.0 | 11.0 | |
| 61 | + |
| 62 | +[1]: ../assets/chrome.svg |
| 63 | +[2]: ../assets/edge.svg |
| 64 | +[3]: ../assets/firefox.svg |
| 65 | +[4]: ../assets/safari.svg |
| 66 | +[5]: ../assets/opera.svg |
0 commit comments