freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-columns-with-grid-template-columns.md
Oliver Eyton-Williams ee1e8abd87
feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

1.7 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
5a9036d038fddaf9a66b5d32 使用 grid-template-columns 添加多列 0 https://scrimba.com/p/pByETK/c7NzDHv 301117 add-columns-with-grid-template-columns

--description--

简单地添加一个网格元素并不会有任何明显的效果。你还需要明确网格的结构。在一个网格容器中使用 grid-template-columns 属性可以添加一些列,示例如下:

.container {
  display: grid;
  grid-template-columns: 50px 50px;
}

上面的代码会在网格容器中添加两列,宽度均为 50px。grid-template-columns 属性值的个数表示网格的列数,每个值表示相应的列宽度。

--instructions--

请给网格容器设置三个列,每列宽度均为 100px

--hints--

class 为 container 的元素应具有 grid-template-columns 属性,该属性应有三个属性值,均为 100px

assert(
  code.match(
    /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi
  )
);

--seed--

--seed-contents--

<style>
  .d1{background:LightSkyBlue;}
  .d2{background:LightSalmon;}
  .d3{background:PaleTurquoise;}
  .d4{background:LightPink;}
  .d5{background:PaleGreen;}

  .container {
    font-size: 40px;
    width: 100%;
    background: LightGray;
    display: grid;
    /* Only change code below this line */

    
    /* Only change code above this line */
  }
</style>

<div class="container">
  <div class="d1">1</div>
  <div class="d2">2</div>
  <div class="d3">3</div>
  <div class="d4">4</div>
  <div class="d5">5</div>
</div>

--solutions--

<style>.container {grid-template-columns: 100px 100px 100px;}</style>