diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/glossary/grid_cell | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/glossary/grid_cell')
-rw-r--r-- | files/zh-cn/glossary/grid_cell/index.html | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/files/zh-cn/glossary/grid_cell/index.html b/files/zh-cn/glossary/grid_cell/index.html new file mode 100644 index 0000000000..6ac9114bac --- /dev/null +++ b/files/zh-cn/glossary/grid_cell/index.html @@ -0,0 +1,71 @@ +--- +title: Grid Cell +slug: Glossary/Grid_Cell +tags: + - CSS Grids +translation_of: Glossary/Grid_Cell +--- +<p>在<a href="/en-US/docs/Web/CSS/CSS_Grid_Layout">Grid布局</a>中,<strong>网络单元格</strong>是CSS网格中的最小单元。它是四条{{glossary("grid lines","网格线")}}之间的空间,概念上非常像表格单元格。</p> + +<p><img alt="Diagram showing an individual cell on the grid." src="https://mdn.mozillademos.org/files/14767/1_Grid_Cell.png" style="height: 221px; width: 332px;"></p> + +<p>如果不使用网格布局提供的方法去放置网格容器的项目,这些项目将通过自动布局算法被放置到每个网格单元格中。将创建额外的行或列{{glossary("grid tracks", "轨道")}}以创建足够的单元格来保存所有项目。</p> + +<p>在例子中,我们创建了一个三列轨道的网格。五个项目被放置到网格单元格中,它们沿着初始行依次被放置到三个网格单元格中,然后为剩下的两个创建了一个新行。</p> + +<div id="example_1"> +<div class="hidden"> +<pre class="brush: css">* {box-sizing: border-box;} + +.wrapper { + border: 2px solid #f76707; + border-radius: 5px; + background-color: #fff4e6; +} + +.wrapper > div { + border: 2px solid #ffa94d; + border-radius: 5px; + background-color: #ffd8a8; + padding: 1em; + color: #d9480f; +} +</pre> +</div> + +<pre class="brush: css">.wrapper { + display: grid; + grid-template-columns: repeat(3,1fr); + grid-auto-rows: 100px; +} +</pre> + +<pre class="brush: html"><div class="wrapper"> + <div>One</div> + <div>Two</div> + <div>Three</div> + <div>Four</div> + <div>Five</div> +</div> +</pre> + +<p>{{ EmbedLiveSample('example_1', '300', '280') }}</p> +</div> + +<h2 id="了解更多">了解更多</h2> + +<h3 id="属性参考">属性参考</h3> + +<ul> + <li>{{cssxref("grid-template-columns")}}</li> + <li>{{cssxref("grid-template-rows")}}</li> + <li>{{cssxref("grid-auto-rows")}}</li> + <li>{{cssxref("grid-auto-columns")}}</li> +</ul> + +<h3 id="扩展阅读">扩展阅读</h3> + +<ul> + <li>CSS Grid Layout Guide: <em><a href="/en-US/docs/Web/CSS/CSS_Grid_Layout/Basic_Concepts_of_Grid_Layout">Basic concepts of grid layout</a></em></li> + <li><a href="https://drafts.csswg.org/css-grid/#grid-track-concept">Definition of Grid Cells in the CSS Grid Layout specification</a></li> +</ul> |