From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/glossary/grid_areas/index.html | 80 ++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 files/zh-cn/glossary/grid_areas/index.html (limited to 'files/zh-cn/glossary/grid_areas') diff --git a/files/zh-cn/glossary/grid_areas/index.html b/files/zh-cn/glossary/grid_areas/index.html new file mode 100644 index 0000000000..bbed0c4c8c --- /dev/null +++ b/files/zh-cn/glossary/grid_areas/index.html @@ -0,0 +1,80 @@ +--- +title: Grid Areas +slug: Glossary/Grid_Areas +tags: + - CSS Grids +translation_of: Glossary/Grid_Areas +--- +

网格区域是网格中由一个或者多个{{glossary("grid cell", "网格单元格")}}组成的一个矩形区域。当你使用基于网格线位置放置一个项目或者使用命名的网格区域定义区域时,网格区域被创建。

+ +

Image showing a highlighted grid area

+ +

本质上,网格区域一定是矩形的。例如,不可能创建T形或L形的网格区域。

+ +

在下面的例子中,有一个网格容器包含两个网格项目,我用 {{cssxref("grid-area")}} 属性命名它们,然后用 {{cssxref("grid-template-areas")}} 把它们放在网格上。这将创建两个网格区域,一个覆盖四个网格单元格,另外一个覆盖两个。

+ +
+ + +
.wrapper {
+  display: grid;
+  grid-template-columns: repeat(3,1fr);
+  grid-template-rows: 100px 100px;
+  grid-template-areas:
+    "a a b"
+    "a a b";
+}
+.item1 {
+  grid-area: a;
+}
+.item2 {
+  grid-area: b;
+}
+
+ +
<div class="wrapper">
+   <div class="item1">Item</div>
+   <div class="item2">Item</div>
+</div>
+
+ +

{{ EmbedLiveSample('example_1', '300', '280') }}

+
+ +

了解更多

+ +

属性参考

+ + + +

扩展阅读

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