From 8c509c815fd59af2d2ed09eda7169a9f11333f7b Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Tue, 30 Nov 2021 01:04:30 +0900 Subject: CSS グリッドレイアウトのリファレンスの変換準備 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/css/grid/index.md | 197 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 files/ja/web/css/grid/index.md (limited to 'files/ja/web/css/grid/index.md') diff --git a/files/ja/web/css/grid/index.md b/files/ja/web/css/grid/index.md new file mode 100644 index 0000000000..6b5a8f0d1f --- /dev/null +++ b/files/ja/web/css/grid/index.md @@ -0,0 +1,197 @@ +--- +title: grid +slug: Web/CSS/grid +tags: + - CSS + - CSS グリッド + - CSS プロパティ + - Reference + - grid + - grid-auto-columns + - grid-auto-flow + - grid-auto-rows + - grid-template-areas + - grid-template-columns + - grid-template-rows +translation_of: Web/CSS/grid +--- +

CSS の grid プロパティは一括指定プロパティで、明示的なすべてのグリッドプロパティ ({{cssxref("grid-template-rows")}}, {{cssxref("grid-template-columns")}}, {{cssxref("grid-template-areas")}}) と、暗黙のすべてのグリッドプロパティ ({{cssxref("grid-auto-rows")}}, {{cssxref("grid-auto-columns")}}, {{cssxref("grid-auto-flow")}}) を単一の宣言で設定します。

+ +
{{EmbedInteractiveExample("pages/css/grid.html")}}
+ + + +
+

メモ: 明示的なグリッドプロパティ、または暗黙のグリッドプロパティのみを単一の grid 宣言で設定することができます。指定しないサブプロパティは、通常の一括指定と同様に初期値に設定されます。また、 gutter プロパティはこの一括指定では初期化されません。

+
+ +

構文

+ +
/* <'grid-template'> 値 */
+grid: none;
+grid: "a" 100px "b" 1fr;
+grid: [linename1] "a" 100px [linename2];
+grid: "a" 200px "b" min-content;
+grid: "a" minmax(100px, max-content) "b" 20%;
+grid: 100px / 200px;
+grid: minmax(400px, min-content) / repeat(auto-fill, 50px);
+
+/* <'grid-template-rows'> /
+   [ auto-flow && dense? ] <'grid-auto-columns'>? values */
+grid: 200px / auto-flow;
+grid: 30% / auto-flow dense;
+grid: repeat(3, [line1 line2 line3] 200px) / auto-flow 300px;
+grid: [line1] minmax(20em, max-content) / auto-flow dense 40%;
+
+/* [ auto-flow && dense? ] <'grid-auto-rows'>? /
+   <'grid-template-columns'> values */
+grid: auto-flow / 200px;
+grid: auto-flow dense / 30%;
+grid: auto-flow 300px / repeat(3, [line1 line2 line3] 200px);
+grid: auto-flow dense 40% / [line1] minmax(20em, max-content);
+
+/* グローバル値	 */
+grid: inherit;
+grid: initial;
+grid: unset;
+
+ +

+ +
+
<'grid-template'>
+
{{cssxref("grid-template")}} を定義し、これには {{cssxref("grid-template-columns")}}, {{cssxref("grid-template-rows")}}, {{cssxref("grid-template-areas")}} が含まれます。
+
<'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>?
+
{{cssxref("grid-template-rows")}} プロパティを明示的に設定 (および {{cssxref("grid-template-columns")}} プロパティを none に設定) することで行トラックを設定し、 {{cssxref("grid-auto-columns")}} プロパティを設定 (および {{cssxref("grid-auto-rows")}} を auto に設定) することで列トラックの自動反復方法を設定します。 dense が設定されていれば、 {{cssxref("grid-auto-flow")}} も column に設定されます。 +

ほかの grid のサブプロパティはすべて、初期値に初期化されます。

+
+
[ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>
+
{{cssxref("grid-template-columns")}} プロパティを明示的に設定 (および {{cssxref("grid-template-rows")}} プロパティを none に設定) することで列トラックを設定し、 {{cssxref("grid-auto-rows")}} プロパティを設定 (および {{cssxref("grid-auto-columns")}} を auto に設定) することで行トラックの児童反復方法を設定します。 dense が設定されていれば、 {{cssxref("grid-auto-flow")}} も column に設定されます。 +

ほかの grid のサブプロパティはすべて、初期値に初期化されます。

+
+
+ +

形式文法

+ +{{csssyntax}} + +

+ +

HTML

+ +
<div id="container">
+  <div></div>
+  <div></div>
+  <div></div>
+  <div></div>
+  <div></div>
+  <div></div>
+  <div></div>
+  <div></div>
+</div>
+ +

CSS

+ +
#container {
+  display: grid;
+  grid: repeat(2, 60px) / auto-flow 80px;
+}
+
+#container > div {
+  background-color: #8ca0ff;
+  width: 50px;
+  height: 50px;
+}
+ +

結果

+ +

{{EmbedLiveSample("Example", "100%", 150)}}

+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName("CSS3 Grid", "#propdef-grid", "grid")}}{{Spec2("CSS3 Grid")}}初回定義
+ +

{{cssinfo}}

+ +

ブラウザーの対応

+ +

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

+ +

関連情報

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