From 76c96022ca053fb17e38e3025d4007361a40e924 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Mon, 1 Nov 2021 00:50:42 +0900 Subject: CSS フレックスボックス関係の文書の Markdown 変換準備 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/css/flex-direction/index.md | 156 +++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 files/ja/web/css/flex-direction/index.md (limited to 'files/ja/web/css/flex-direction/index.md') diff --git a/files/ja/web/css/flex-direction/index.md b/files/ja/web/css/flex-direction/index.md new file mode 100644 index 0000000000..8e6f817697 --- /dev/null +++ b/files/ja/web/css/flex-direction/index.md @@ -0,0 +1,156 @@ +--- +title: flex-direction +slug: Web/CSS/flex-direction +tags: + - CSS + - CSS Flexible Boxes + - CSS Property + - Reference + - 'recipe:css-property' +translation_of: Web/CSS/flex-direction +--- +
{{CSSRef}}
+ +

flex-directionCSS のプロパティで、主軸の方向や向き (通常または逆方向) を定義することにより、フレックスコンテナー内でフレックスアイテムを配置する方法を設定します。

+ +
{{EmbedInteractiveExample("pages/css/flex-direction.html")}}
+ + + +

なお、 row および row-reverse の値は、フレックスコンテナーの書字方向に影響されます。 {{HTMLAttrxRef("dir")}} 属性が ltr である場合は、 row は左から右へ向かう水平軸を表し、また row-reverse は右から左へ向かう水平軸を表します。一方、 dir 属性が rtl である場合は、 row は右から左へ向かう水平軸を表し、また row-reverse は左から右へ向かう水平軸を表します。

+ +

構文

+ +
/* 行のテキストの方向に配置 */
+flex-direction: row;
+
+/* <row> と同様だが、逆向き */
+flex-direction: row-reverse;
+
+/* 積み重なるように配置する */
+flex-direction: column;
+
+/* <column> と同様だが、逆向き */
+flex-direction: column-reverse;
+
+/* グローバル値 */
+flex-direction: inherit;
+flex-direction: initial;
+flex-direction: unset;
+
+ +

+ +

以下の値を指定できます。

+ +
+
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 の位置が入れ替わります。
+
+ +

アクセシビリティの考慮

+ +

flex-direction プロパティを row-reverse または column-reverse の値で使うと、視覚上の表示と DOM の順序が一致しなくなります。これは、スクリーンリーダーなどの支援技術を使っている視覚障害者に不利な影響を及ぼします。視覚的な (CSS の) 順序が重要である場合は、読み上げソフトの利用者は正しい読み上げ順序でアクセスすることができなくなります。

+ + + +

公式定義

+ +

{{cssinfo}}

+ +

形式文法

+ +{{csssyntax}} + +

+ +

フレックスコンテナーの列と行の反転

+ +

HTML

+ +
<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>
+
+ +

CSS

+ +
#content {
+  width: 200px;
+  height: 200px;
+  border: 1px solid #c3c3c3;
+  display: flex;
+  flex-direction: column-reverse;
+}
+
+.box {
+  width: 50px;
+  height: 50px;
+}
+
+#content1 {
+  width: 200px;
+  height: 200px;
+  border: 1px solid #c3c3c3;
+  display: flex;
+  flex-direction: row-reverse;
+}
+
+.box1 {
+  width: 50px;
+  height: 50px;
+}
+ +

結果

+ +

{{EmbedLiveSample('Reversing_flex_container_columns_and_rows', '', '550')}}

+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('CSS3 Flexbox', '#flex-direction', 'flex-direction')}}{{Spec2('CSS3 Flexbox')}}初回定義
+ +

ブラウザーの互換性

+ +

{{Compat("css.properties.flex-direction")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf