HTML <入力>最大属性
例
最小属性と最大属性の使用:
<form action="/action_page.php">
<label for="datemax">Enter a date before 1980-01-01:</label>
<input type="date" id="datemax" name="datemax" max="1979-12-31"><br><br>
<label for="datemin">Enter a date after 2000-01-01:</label>
<input type="date" id="datemin" name="datemin" min="2000-01-02"><br><br>
<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5"><br><br>
<input type="submit">
</form>
定義と使用法
このmax
属性は、要素の最大値を指定します<input>
。
ヒント:max
属性を属性と一緒に
使用してmin
、有効な値の範囲を作成します。
注:max
and属性は
min
、数値、範囲、日付、日時-ローカル、月、時刻、および週の入力タイプで機能します。
ブラウザのサポート
表の数字は、属性を完全にサポートする最初のブラウザーバージョンを示しています。
Attribute | |||||
---|---|---|---|---|---|
max | 5.0 | 10.0 | 16.0 | 5.1 | 10.6 |
構文
<input max="number|date">
属性値
Value | Description |
---|---|
number | Specifies the maximum value allowed |
date | Specifies the maximum date allowed |
❮HTML<input>タグ