diff options
Diffstat (limited to 'files/ja/web/css/height')
-rw-r--r-- | files/ja/web/css/height/index.html | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/files/ja/web/css/height/index.html b/files/ja/web/css/height/index.html new file mode 100644 index 0000000000..9fa11ce89d --- /dev/null +++ b/files/ja/web/css/height/index.html @@ -0,0 +1,167 @@ +--- +title: height +slug: Web/CSS/height +tags: + - CSS + - CSS Property + - CSS プロパティ + - Layout + - Reference + - Vertical + - dimensions + - height + - 'recipe:css-property' + - size + - レイアウト +translation_of: Web/CSS/height +--- +<div>{{CSSRef}}</div> + +<p><strong><code>height</code></strong> は CSS のプロパティで、要素の高さを指定します。既定では、このプロパティは<a href="/ja/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model#content-area">コンテンツ領域</a>の高さを定義します。しかし、 {{cssxref("box-sizing")}} が <code>border-box</code> に設定されていた場合は、 <a href="/ja/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model#border-area">境界領域</a>の高さを定義します。</p> + +<div>{{EmbedInteractiveExample("pages/css/height.html")}}</div> + +<p class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</p> + +<p>{{cssxref("min-height")}} 及び {{cssxref("max-height")}} プロパティは <code>height</code> を上書きします。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="brush:css no-line-numbers notranslate">/* キーワード値 */ +height: auto; + +/* <length> 値 */ +height: 120px; +height: 10em; + +/* <percentage> 値 */ +height: 75%; + +/* グローバル値 */ +height: inherit; +height: initial; +height: unset; +</pre> + +<h3 id="Values" name="Values">値</h3> + +<dl> + <dt>{{cssxref("<length>")}}</dt> + <dd>絶対値で高さを定義します。</dd> + <dt>{{cssxref("<percentage>")}}</dt> + <dd>包含ブロックの高さのパーセントで高さを定義します。</dd> + <dt><code>auto</code></dt> + <dd>指定された要素の高さをブラウザーが計算して決めます。</dd> + <dt><code>max-content</code></dt> + <dd>本来の望ましい高さです。</dd> + <dt><code>min-content</code></dt> + <dd>本来の最小の高さです。</dd> + <dt><code>fit-content({{cssxref("<length-percentage>")}})</code></dt> + <dd>利用可能な空間に対して fit-content 式を使用し、指定された引数に置き換えられます。すなわち min(max-content, max(min-content, )) です。</dd> +</dl> + +<h3 id="Formal_syntax" name="Formal_syntax">形式文法</h3> + +<pre class="syntaxbox notranslate">{{csssyntax}}</pre> + +<h2 id="Example" name="Example">例</h2> + +<h3 id="HTML" name="HTML">HTML</h3> + +<pre class="brush: html notranslate"><div id="taller">50ピクセルの高さです。</div> +<div id="shorter">25ピクセルの高さです。</div> +<div id="parent"> + <div id="child"> + 親の半分の高さです。 + </div> +</div> +</pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css notranslate">div { + width: 250px; + margin-bottom: 5px; + border: 2px solid blue; +} + +#taller { + height: 50px; +} + +#shorter { + height: 25px; +} + +#parent { + height: 100px; +} + +#child { + height: 50%; + width: 75%; +} +</pre> + +<h3 id="Result" name="Result">結果</h3> + +<p>{{EmbedLiveSample('Example', 'auto', 240)}}</p> + +<h2 id="Accessibility_concerns" name="Accessibility_concerns">アクセシビリティの考慮事項</h2> + +<p>テキストを大きくするためにページを拡大したとき、他のコンテンツを切り捨てたり邪魔したりしないように要素の <code>height</code> を設定するよう確認してください。</p> + +<ul> + <li><a href="/ja/docs/Web/Accessibility/Understanding_WCAG/Perceivable#Guideline_1.4_Make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background">MDN "WCAG を理解する ― ガイドライン 1.4 の解説"</a></li> + <li><a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html">Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0</a></li> +</ul> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様書</th> + <th scope="col">状態</th> + <th scope="col">備考</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('CSS4 Sizing', '#width-height-keywords', 'height')}}</td> + <td>{{Spec2('CSS4 Sizing')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('CSS3 Sizing', '#width-height-keywords', 'height')}}</td> + <td>{{Spec2('CSS3 Sizing')}}</td> + <td>キーワード <code>max-content</code>, <code>min-content</code>, <code>available</code>, <code>fit-content</code> の追加。</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'visudet.html#the-height-property', 'height')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>{{cssxref("<length>")}} 値のサポートを追加。どの要素に用いるかを明記。</td> + </tr> + <tr> + <td>{{SpecName('CSS1', '#height', 'height')}}</td> + <td>{{Spec2('CSS1')}}</td> + <td>初回定義</td> + </tr> + </tbody> +</table> + +<p>{{cssinfo}}</p> + +<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("css.properties.height")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model">ボックスモデル</a>, {{cssxref("box-sizing")}}</li> + <li>{{cssxref("max-height")}}, {{cssxref("min-height")}}</li> + <li>対応する論理的プロパティ: {{cssxref("block-size")}}, {{cssxref("inline-size")}}</li> +</ul> |