diff options
Diffstat (limited to 'files/ja/web/css/flex-direction')
-rw-r--r-- | files/ja/web/css/flex-direction/index.md | 173 |
1 files changed, 81 insertions, 92 deletions
diff --git a/files/ja/web/css/flex-direction/index.md b/files/ja/web/css/flex-direction/index.md index 8e6f817697..0336d1480c 100644 --- a/files/ja/web/css/flex-direction/index.md +++ b/files/ja/web/css/flex-direction/index.md @@ -3,104 +3,102 @@ title: flex-direction slug: Web/CSS/flex-direction tags: - CSS - - CSS Flexible Boxes - - CSS Property - - Reference - - 'recipe:css-property' + - CSS フレックスボックス + - CSS プロパティ + - リファレンス + - recipe:css-property +browser-compat: css.properties.flex-direction translation_of: Web/CSS/flex-direction --- -<div>{{CSSRef}}</div> +{{CSSRef}} -<p><span class="seoSummary"><strong><code>flex-direction</code></strong> は <a href="/ja/docs/Web/CSS">CSS</a> のプロパティで、主軸の方向や向き (通常または逆方向) を定義することにより、フレックスコンテナー内でフレックスアイテムを配置する方法を設定します。</span></p> +**`flex-direction`** は [CSS](/ja/docs/Web/CSS) のプロパティで、主軸の方向や向き (通常または逆方向) を定義することにより、フレックスコンテナー内でフレックスアイテムを配置する方法を設定します。 -<div>{{EmbedInteractiveExample("pages/css/flex-direction.html")}}</div> +{{EmbedInteractiveExample("pages/css/flex-direction.html")}} -<p class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</p> +なお、 `row` および `row-reverse` の値は、フレックスコンテナーの書字方向に影響されます。 {{HTMLAttrxRef("dir")}} 属性が `ltr` である場合は、 `row` は左から右へ向かう水平軸を表し、また `row-reverse` は右から左へ向かう水平軸を表します。一方、 `dir` 属性が `rtl` である場合は、 `row` は右から左へ向かう水平軸を表し、また `row-reverse` は左から右へ向かう水平軸を表します。 -<p>なお、 <code>row</code> および <code>row-reverse</code> の値は、フレックスコンテナーの書字方向に影響されます。 {{HTMLAttrxRef("dir")}} 属性が <code>ltr</code> である場合は、 <code>row</code> は左から右へ向かう水平軸を表し、また <code>row-reverse</code> は右から左へ向かう水平軸を表します。一方、 <code>dir</code> 属性が <code>rtl</code> である場合は、 <code>row</code> は右から左へ向かう水平軸を表し、また <code>row-reverse</code> は左から右へ向かう水平軸を表します。</p> +## 構文 -<h2 id="Syntax" name="Syntax">構文</h2> - -<pre class="brush:css no-line-numbers notranslate">/* 行のテキストの方向に配置 */ +```css +/* 行のテキストの方向に配置 */ flex-direction: row; -/* <row> と同様だが、逆向き */ +/* <row> と同様だが、逆向き */ flex-direction: row-reverse; /* 積み重なるように配置する */ flex-direction: column; -/* <column> と同様だが、逆向き */ +/* <column> と同様だが、逆向き */ flex-direction: column-reverse; /* グローバル値 */ flex-direction: inherit; flex-direction: initial; +flex-direction: revert; flex-direction: unset; -</pre> +``` -<h3 id="Values" name="Values">値</h3> +### 値 -<p>以下の値を指定できます。</p> +以下の値を指定できます。 -<dl> - <dt><code>row</code></dt> - <dd>フレックスコンテナーの主軸は、書字方向と同じに定義されます。 <strong>main-start</strong> および <strong>main-end</strong> の位置は、コンテンツの書字方向と同様になります。</dd> - <dt><code>row-reverse</code></dt> - <dd><code>row</code> と同様ですが、<strong>main-start</strong> および <strong>main-end</strong> の位置が入れ替わります。</dd> - <dt><code>column</code></dt> - <dd>フレックスコンテナーの主軸は、ブロック軸と同じになります。 <strong>main-start</strong> および <strong>main-end</strong> の位置は、 writing-mode における <strong>before</strong> および <strong>after</strong> の位置と同じになります。</dd> - <dt><code>column-reverse</code></dt> - <dd><code>column</code> と同様ですが、 <strong>main-start</strong> および <strong>main-end</strong> の位置が入れ替わります。</dd> -</dl> +- `row` + - : フレックスコンテナーの主軸は、書字方向と同じに定義されます。 **main-start** および **main-end** の位置は、コンテンツの書字方向と同様になります。 +- `row-reverse` + - : `row` と同様ですが、**main-start** および **main-end** の位置が入れ替わります。 +- `column` + - : フレックスコンテナーの主軸は、ブロック軸と同じになります。 **main-start** および **main-end** の位置は、 writing-mode における **before** および **after** の位置と同じになります。 +- `column-reverse` + - : `column` と同様ですが、 **main-start** および **main-end** の位置が入れ替わります。 -<h2 id="Accessibility_concerns" name="Accessibility_concerns">アクセシビリティの考慮</h2> +## アクセシビリティの考慮 -<p><code>flex-direction</code> プロパティを <code>row-reverse</code> または <code>column-reverse</code> の値で使うと、視覚上の表示と DOM の順序が一致しなくなります。これは、スクリーンリーダーなどの支援技術を使っている視覚障害者に不利な影響を及ぼします。視覚的な (CSS の) 順序が重要である場合は、読み上げソフトの利用者は正しい読み上げ順序でアクセスすることができなくなります。</p> +`flex-direction` プロパティを `row-reverse` または `column-reverse` の値で使うと、視覚上の表示と DOM の順序が一致しなくなります。これは、画面リーダーなどの支援技術を使っている視覚障害者に不利な影響を及ぼします。視覚的な (CSS の) 順序が重要である場合は、画面リーダーの利用者は正しい読み上げ順序でアクセスすることができなくなります。 -<ul> - <li><a class="external external-icon" href="https://tink.uk/flexbox-the-keyboard-navigation-disconnect/" rel="noopener">Flexbox & the keyboard navigation disconnect — Tink</a></li> - <li><a class="external external-icon" href="http://adrianroselli.com/2015/09/source-order-matters.html" rel="noopener">Source Order Matters | Adrian Roselli</a></li> - <li><a href="/ja/docs/Web/Accessibility/Understanding_WCAG/Perceivable#Guideline_1.3_%E2%80%94_Create_content_that_can_be_presented_in_different_ways">MDN "WCAG を理解する ― ガイドライン 1.3 の解説"</a></li> - <li><a class="external external-icon" href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/content-structure-separation-sequence.html" rel="noopener">Understanding Success Criterion 1.3.2 | W3C Understanding WCAG 2.0</a></li> -</ul> +- [Flexbox & the keyboard navigation disconnect — Tink](https://tink.uk/flexbox-the-keyboard-navigation-disconnect/) +- [Source Order Matters | Adrian Roselli](https://adrianroselli.com/2015/09/source-order-matters.html) +- [MDN "WCAG を理解する ― ガイドライン 1.3 の解説"](/ja/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.3_%e2%80%94_create_content_that_can_be_presented_in_different_ways) +- [Understanding Success Criterion 1.3.2 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/content-structure-separation-sequence.html) -<h2 id="Formal_definition" name="Formal_definition">公式定義</h2> +## 公式定義 -<p>{{cssinfo}}</p> +{{cssinfo}} -<h3 id="Formal_syntax" name="Formal_syntax">形式文法</h3> +## 形式文法 {{csssyntax}} -<h2 id="Examples" name="Examples">例</h2> +## 例 -<h3 id="Reversing_flex_container_columns_and_rows" name="Reversing_flex_container_columns_and_rows">フレックスコンテナーの列と行の反転</h3> +<h3 id="Reversing_flex_container_columns_and_rows">フレックスコンテナーの列と行の反転</h3> -<h4 id="HTML" name="HTML">HTML</h4> +#### HTML -<pre class="brush: html notranslate"><h4>This is a Column-Reverse</h4> -<div id="content"> - <div class="box" style="background-color:red;">A</div> - <div class="box" style="background-color:lightblue;">B</div> - <div class="box" style="background-color:yellow;">C</div> -</div> -<h4>This is a Row-Reverse</h4> -<div id="content1"> - <div class="box1" style="background-color:red;">A</div> - <div class="box1" style="background-color:lightblue;">B</div> - <div class="box1" style="background-color:yellow;">C</div> -</div> -</pre> +```html +<h4>This is a Column-Reverse</h4> +<div id="col-rev" class="content"> + <div class="box red">A</div> + <div class="box lightblue">B</div> + <div class="box yellow">C</div> +</div> +<h4>This is a Row-Reverse</h4> +<div id="row-rev" class="content"> + <div class="box red">A</div> + <div class="box lightblue">B</div> + <div class="box yellow">C</div> +</div> +``` -<h4 id="CSS">CSS</h4> +#### CSS -<pre class="brush: css notranslate">#content { +```css +.content { width: 200px; height: 200px; border: 1px solid #c3c3c3; display: flex; - flex-direction: column-reverse; } .box { @@ -108,49 +106,40 @@ flex-direction: unset; height: 50px; } -#content1 { - width: 200px; - height: 200px; - border: 1px solid #c3c3c3; - display: flex; +#col-rev { + flex-direction: column-reverse; +} + +#row-rev { flex-direction: row-reverse; } -.box1 { - width: 50px; - height: 50px; -}</pre> +.red { + background-color: red; +} + +.lightblue { + background-color: lightblue; +} + +.yellow { + background-color: yellow; +} +``` -<h4 id="Result" name="Result">結果</h4> +#### 結果 -<p>{{EmbedLiveSample('Reversing_flex_container_columns_and_rows', '', '550')}}</p> +{{EmbedLiveSample('Reversing_flex_container_columns_and_rows', '', '550')}} -<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('CSS3 Flexbox', '#flex-direction', 'flex-direction')}}</td> - <td>{{Spec2('CSS3 Flexbox')}}</td> - <td>初回定義</td> - </tr> - </tbody> -</table> +{{Specifications}} -<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> +## ブラウザーの互換性 -<p>{{Compat("css.properties.flex-direction")}}</p> +{{Compat}} -<h2 id="See_also" name="See_also">関連情報</h2> +## 関連情報 -<ul> - <li>CSS フレックスボックスガイド: <em><a href="/ja/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox">フレックスボックスの基本概念</a></em></li> - <li>CSS フレックスボックスガイド: <em><a href="/ja/docs/Web/CSS/CSS_Flexible_Box_Layout/Ordering_Flex_Items">フレックスアイテムの並べ替え</a></em></li> -</ul> +- CSS フレックスボックスガイド: _[フレックスボックスの基本概念](/ja/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox)_ +- CSS フレックスボックスガイド: _[フレックスアイテムの並べ替え](/ja/docs/Web/CSS/CSS_Flexible_Box_Layout/Ordering_Flex_Items)_ |