aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/css/height
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/web/css/height')
-rw-r--r--files/ja/web/css/height/index.md200
1 files changed, 87 insertions, 113 deletions
diff --git a/files/ja/web/css/height/index.md b/files/ja/web/css/height/index.md
index 4728fdfa86..1bc5856aff 100644
--- a/files/ja/web/css/height/index.md
+++ b/files/ja/web/css/height/index.md
@@ -3,83 +3,98 @@ title: height
slug: Web/CSS/height
tags:
- CSS
- - CSS Property
- CSS プロパティ
- - Layout
- - Reference
- - Vertical
- - dimensions
+ - レイアウト
+ - リファレンス
+ - 垂直
+ - 寸法
- height
- - 'recipe:css-property'
+ - recipe:css-property
- size
- - レイアウト
+browser-compat: css.properties.height
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>
+{{CSSRef}}
-<div>{{EmbedInteractiveExample("pages/css/height.html")}}</div>
+**`height`** は CSS のプロパティで、要素の高さを指定します。既定では、このプロパティは[コンテンツ領域](/ja/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model#content-area)の高さを定義します。{{cssxref("box-sizing")}} が `border-box` に設定されていた場合は、 [境界領域](/ja/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model#border-area)の高さを定義します。
-<p class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</p>
+{{EmbedInteractiveExample("pages/css/height.html")}}
-<p>{{cssxref("min-height")}} 及び {{cssxref("max-height")}} プロパティは <code>height</code> を上書きします。</p>
+{{cssxref("min-height")}} および {{cssxref("max-height")}} プロパティは `height` を上書きします。
-<h2 id="Syntax" name="Syntax">構文</h2>
+## 構文
-<pre class="brush:css no-line-numbers notranslate">/* キーワード値 */
-height: auto;
-
-/* &lt;length&gt; 値 */
+```css
+/* <length> 値 */
height: 120px;
height: 10em;
-/* &lt;percentage&gt; 値 */
+/* <percentage> 値 */
height: 75%;
+/* キーワード値 */
+height: max-content;
+height: min-content;
+height: fit-content(20em);
+height: auto;
+
/* グローバル値 */
height: inherit;
height: initial;
+height: revert;
height: unset;
-</pre>
-
-<h3 id="Values" name="Values">値</h3>
-
-<dl>
- <dt>{{cssxref("&lt;length&gt;")}}</dt>
- <dd>絶対値で高さを定義します。</dd>
- <dt>{{cssxref("&lt;percentage&gt;")}}</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("&lt;length-percentage&gt;")}})</code></dt>
- <dd>利用可能な空間に対して fit-content 式を使用し、指定された引数に置き換えられます。すなわち min(max-content, max(min-content, )) です。</dd>
-</dl>
-
-<h3 id="Formal_syntax" name="Formal_syntax">形式文法</h3>
+```
+
+### 値
+
+- {{cssxref("&lt;length&gt;")}}
+ - : 絶対値で高さを定義します。
+- {{cssxref("&lt;percentage&gt;")}}
+ - : 包含ブロックの高さのパーセントで高さを定義します。
+- `auto`
+ - : 指定された要素の高さをブラウザーが計算して決めます。
+- `max-content`
+ - : 本来の望ましい高さです。
+- `min-content`
+ - : 本来の最小の高さです。
+- `fit-content({{cssxref("&lt;length-percentage&gt;")}})`
+ - : 利用可能な空間に対して fit-content 式を使用し、指定された引数に置き換えられます。すなわち `min(max-content, max(min-content, <length-percentage>))` です。
+
+## アクセシビリティの考慮
+
+要素の `height` は、テキストを大きくするためにページを拡大したとき、切り捨てたられたり他のコンテンツを邪魔したりしないように設定するよう確認してください。
+
+- [MDN "WCAG を理解する ― ガイドライン 1.4 の解説"](/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)
+- [Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html)
+
+## 公式定義
+
+{{CSSInfo}}
+
+## 形式文法
{{csssyntax}}
-<h2 id="Example" name="Example">例</h2>
+## 例
-<h3 id="HTML" name="HTML">HTML</h3>
+<h3 id="Setting_height_using_pixels_and_percentages">ピクセル数とパーセント値を使用して高さを設定</h3>
-<pre class="brush: html notranslate">&lt;div id="taller"&gt;50ピクセルの高さです。&lt;/div&gt;
-&lt;div id="shorter"&gt;25ピクセルの高さです。&lt;/div&gt;
-&lt;div id="parent"&gt;
- &lt;div id="child"&gt;
- 親の半分の高さです。
- &lt;/div&gt;
-&lt;/div&gt;
-</pre>
+#### HTML
-<h3 id="CSS">CSS</h3>
+```html
+<div id="taller">I'm 50 pixels tall.</div>
+<div id="shorter">I'm 25 pixels tall.</div>
+<div id="parent">
+ <div id="child">
+ I'm half the height of my parent.
+ </div>
+</div>
+```
-<pre class="brush: css notranslate">div {
+#### CSS
+
+```css
+div {
width: 250px;
margin-bottom: 5px;
border: 2px solid blue;
@@ -101,65 +116,24 @@ height: unset;
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("&lt;length&gt;")}} 値のサポートを追加。どの要素に用いるかを明記。</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>
-
-<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>
+```
+
+#### 結果
+
+{{EmbedLiveSample('Setting_height_using_pixels_and_percentages', 'auto', 240)}}
+
+## 仕様書
+
+{{Specifications}}
+
+## ブラウザーの互換性
+
+{{Compat}}
+
+## 関連情報
+
+- [ボックスモデル](/ja/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model)
+- {{cssxref("width")}}
+- {{cssxref("box-sizing")}}
+- {{cssxref("min-height")}}, {{cssxref("max-height")}}
+- 対応する論理的プロパティ: {{cssxref("block-size")}}, {{cssxref("inline-size")}}