From b878d4a1cf8abdbaef200f64391ed6af2d80c2a6 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Tue, 16 Nov 2021 10:16:30 +0900 Subject: CSS Box Sizing 関連のリファレンスを更新 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 2021/11/14 時点の英語版に同期 --- files/ja/web/css/height/index.md | 200 +++++++++++++++++---------------------- 1 file changed, 87 insertions(+), 113 deletions(-) (limited to 'files/ja/web/css/height') 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 --- -
{{CSSRef}}
- -

height は CSS のプロパティで、要素の高さを指定します。既定では、このプロパティはコンテンツ領域の高さを定義します。しかし、 {{cssxref("box-sizing")}} が border-box に設定されていた場合は、 境界領域の高さを定義します。

+{{CSSRef}} -
{{EmbedInteractiveExample("pages/css/height.html")}}
+**`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)の高さを定義します。 - +{{EmbedInteractiveExample("pages/css/height.html")}} -

{{cssxref("min-height")}} 及び {{cssxref("max-height")}} プロパティは height を上書きします。

+{{cssxref("min-height")}} および {{cssxref("max-height")}} プロパティは `height` を上書きします。 -

構文

+## 構文 -
/* キーワード値 */
-height: auto;
-
-/* <length> 値 */
+```css
+/*  値 */
 height: 120px;
 height: 10em;
 
-/* <percentage> 値 */
+/*  値 */
 height: 75%;
 
+/* キーワード値 */
+height: max-content;
+height: min-content;
+height: fit-content(20em);
+height: auto;
+
 /* グローバル値 */
 height: inherit;
 height: initial;
+height: revert;
 height: unset;
-
- -

- -
-
{{cssxref("<length>")}}
-
絶対値で高さを定義します。
-
{{cssxref("<percentage>")}}
-
包含ブロックの高さのパーセントで高さを定義します。
-
auto
-
指定された要素の高さをブラウザーが計算して決めます。
-
max-content
-
本来の望ましい高さです。
-
min-content
-
本来の最小の高さです。
-
fit-content({{cssxref("<length-percentage>")}})
-
利用可能な空間に対して fit-content 式を使用し、指定された引数に置き換えられます。すなわち min(max-content, max(min-content, )) です。
-
- -

形式文法

+``` + +### 値 + +- {{cssxref("<length>")}} + - : 絶対値で高さを定義します。 +- {{cssxref("<percentage>")}} + - : 包含ブロックの高さのパーセントで高さを定義します。 +- `auto` + - : 指定された要素の高さをブラウザーが計算して決めます。 +- `max-content` + - : 本来の望ましい高さです。 +- `min-content` + - : 本来の最小の高さです。 +- `fit-content({{cssxref("<length-percentage>")}})` + - : 利用可能な空間に対して fit-content 式を使用し、指定された引数に置き換えられます。すなわち `min(max-content, max(min-content, ))` です。 + +## アクセシビリティの考慮 + +要素の `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}} -

+## 例 -

HTML

+

ピクセル数とパーセント値を使用して高さを設定

-
<div id="taller">50ピクセルの高さです。</div>
-<div id="shorter">25ピクセルの高さです。</div>
-<div id="parent">
-  <div id="child">
-    親の半分の高さです。
-  </div>
-</div>
-
+#### HTML -

CSS

+```html +
I'm 50 pixels tall.
+
I'm 25 pixels tall.
+
+
+ I'm half the height of my parent. +
+
+``` -
div {
+#### CSS
+
+```css
+div {
   width: 250px;
   margin-bottom: 5px;
   border: 2px solid blue;
@@ -101,65 +116,24 @@ height: unset;
   height: 50%;
   width: 75%;
 }
-
- -

結果

- -

{{EmbedLiveSample('Example', 'auto', 240)}}

- -

アクセシビリティの考慮事項

- -

テキストを大きくするためにページを拡大したとき、他のコンテンツを切り捨てたり邪魔したりしないように要素の height を設定するよう確認してください。

- - - -

仕様書

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('CSS4 Sizing', '#width-height-keywords', 'height')}}{{Spec2('CSS4 Sizing')}}
{{SpecName('CSS3 Sizing', '#width-height-keywords', 'height')}}{{Spec2('CSS3 Sizing')}}キーワード max-content, min-content, available, fit-content の追加。
{{SpecName('CSS2.1', 'visudet.html#the-height-property', 'height')}}{{Spec2('CSS2.1')}}{{cssxref("<length>")}} 値のサポートを追加。どの要素に用いるかを明記。
{{SpecName('CSS1', '#height', 'height')}}{{Spec2('CSS1')}}初回定義
- -

{{cssinfo}}

- -

ブラウザーの互換性

- -

{{Compat("css.properties.height")}}

- -

関連情報

- - +``` + +#### 結果 + +{{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")}} -- cgit v1.2.3-54-g00ecf