2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
id: 5a9036e138fddaf9a66b5d33
|
|
|
|
challengeType: 0
|
2020-02-11 21:39:15 +08:00
|
|
|
videoUrl: 'https://scrimba.com/p/pByETK/cbp9Pua'
|
|
|
|
forumTopicId: 301119
|
2020-10-01 17:54:21 +02:00
|
|
|
title: 使用 grid-template-rows 添加多行
|
2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
2020-02-11 21:39:15 +08:00
|
|
|
<section id='description'>
|
|
|
|
在上个挑战中,你创建的网格会自动设置行数。你可以像用<code>grid-template-columns</code>设置网格的列一样,用<code>grid-template-rows</code>设置网格的行。
|
|
|
|
</section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
## Instructions
|
2020-02-11 21:39:15 +08:00
|
|
|
<section id='instructions'>
|
|
|
|
给网格添加两行,使每行高度均为<code>50px</code>。
|
|
|
|
</section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
|
|
|
tests:
|
2020-02-11 21:39:15 +08:00
|
|
|
- text: '<code>container</code>类应该有<code>grid-template-rows</code>属性,且该属性的两个值均为<code>50px</code>'
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-rows\s*?:\s*?50px\s*?50px\s*?;[\s\S]*}/gi));
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='html-seed'>
|
|
|
|
|
|
|
|
```html
|
|
|
|
<style>
|
|
|
|
.d1{background:LightSkyBlue;}
|
|
|
|
.d2{background:LightSalmon;}
|
|
|
|
.d3{background:PaleTurquoise;}
|
|
|
|
.d4{background:LightPink;}
|
|
|
|
.d5{background:PaleGreen;}
|
2020-02-11 21:39:15 +08:00
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
.container {
|
|
|
|
font-size: 40px;
|
|
|
|
width: 100%;
|
|
|
|
background: LightGray;
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 100px 100px 100px;
|
2020-02-11 21:39:15 +08:00
|
|
|
/* 请在本行以下添加你的代码 */
|
|
|
|
|
|
|
|
|
|
|
|
/* 请在本行以上添加你的代码 */
|
2018-10-10 18:03:03 -04:00
|
|
|
}
|
|
|
|
</style>
|
2020-02-11 21:39:15 +08:00
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
<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>
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
<section id='solution'>
|
|
|
|
|
2020-02-11 21:39:15 +08:00
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|
2020-02-11 21:39:15 +08:00
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
</section>
|
2020-02-11 21:39:15 +08:00
|
|
|
|