diff options
Diffstat (limited to 'files/ja/web/html/attributes/size/index.html')
| -rw-r--r-- | files/ja/web/html/attributes/size/index.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/files/ja/web/html/attributes/size/index.html b/files/ja/web/html/attributes/size/index.html new file mode 100644 index 0000000000..3722ecb051 --- /dev/null +++ b/files/ja/web/html/attributes/size/index.html @@ -0,0 +1,76 @@ +--- +title: 'HTML 属性: size' +slug: Web/HTML/Attributes/size +tags: + - Attribute + - HTML + - Input + - Reference + - Select +translation_of: Web/HTML/Attributes/size +--- +<p>{{HTMLSidebar}}</p> + +<p class="summary"><strong><code>size</code></strong> 属性は、 {{htmlelement('input')}} 要素の幅と {{htmlelement('select')}} 要素の高さを定義します。 <code>input</code> については、 <code>type</code> 属性が {{HTMLElement("input/text", "text")}} または {{HTMLElement("input/password", "password")}} の場合は文字数です。これは 0 以上の整数でなければなりません。 <code>size</code> が指定されていないか、無効な値が指定された場合、入力欄にサイズが宣言されず、そのフォームコントロールはユーザーエージェントに基づいた既定の幅になります。 CSS が幅に影響を与えるプロパティで要素を対象としている場合は、 CSS が優先されます。</p> + +<p><code>size</code> 属性は制約検証には影響しません。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<p>一部の入力型で <code>size</code> を指定すると、入力欄の幅を制御することができます。 select に size を追加すると、閉じた状態のときにいくつの選択肢が見えるかを定義します。</p> + +<pre class="brush: html notranslate"><label for="fruit">Enter a fruit</label> <input type="text" size="15" id="fruit"> +<label for="vegetable">Enter a vegetable</label> <input type="text" id="vegetable"> + +<select name="fruits" size="5"> + <option>banana</option> + <option>cherry</option> + <option>strawberry</option> + <option>durian</option> + <option>blueberry</option> +</select> + +<select name="vegetables" size="5"> +<option>carrot</option> +<option>cucumber</option> +<option>cauliflower</option> +<option>celery</option> +<option>collard greens</option> +</select></pre> + +<p>{{EmbedLiveSample('Examples', '100%', 200)}}</p> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様書</th> + <th scope="col">状態</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'input.html#attr-input-size', 'size attribute')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + </tr> + <tr> + <td>{{SpecName('HTML5.1', 'input.html#attr-size-accept', 'size attribute')}}</td> + <td>{{Spec2('HTML5.1')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<p>{{Compat("html.elements.attribute.size")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><code><a href="/en-US/docs/Web/HTML/Attributes/maxlength">maxlength</a></code></li> + <li><code><a href="/en-US/docs/Web/HTML/Attributes/minlength">minlength</a></code></li> + <li><code><a href="/en-US/docs/Web/HTML/Attributes/pattern">pattern</a></code></li> +</ul> |
