2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
id: 5a90375238fddaf9a66b5d3b
|
|
|
|
challengeType: 0
|
2020-02-11 21:39:15 +08:00
|
|
|
videoUrl: 'https://scrimba.com/p/pByETK/cmzd4fz'
|
|
|
|
forumTopicId: 301123
|
2020-10-01 17:54:21 +02:00
|
|
|
title: 使用 align-self 垂直对齐项目
|
2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
2020-02-11 21:39:15 +08:00
|
|
|
<section id='description'>
|
|
|
|
正如能设置网格项沿行轴对齐方式一样,也可以设置网格项沿列轴对齐:你可以对网格项使用<code>align-self</code>属性。在上一个挑战中适用于<code>justify-self</code>属性的每个值也都适用于<code>align-self</code>属性。
|
|
|
|
</section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
## Instructions
|
2020-02-11 21:39:15 +08:00
|
|
|
<section id='instructions'>
|
|
|
|
用值<code>end</code>使类为<code>item3</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>item3</code>类应该有<code>align-self</code>属性且值为<code>end</code>。'
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert(code.match(/.item3\s*?{[\s\S]*align-self\s*?:\s*?end\s*?;[\s\S]*}/gi));
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='html-seed'>
|
|
|
|
|
|
|
|
```html
|
|
|
|
<style>
|
|
|
|
.item1{background:LightSkyBlue;}
|
|
|
|
.item2{background:LightSalmon;}
|
2020-02-11 21:39:15 +08:00
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
.item3 {
|
|
|
|
background: PaleTurquoise;
|
2020-02-11 21:39:15 +08:00
|
|
|
/* 请在本行以下添加你的代码 */
|
|
|
|
|
|
|
|
|
|
|
|
/* 请在本行以上添加你的代码 */
|
2018-10-10 18:03:03 -04:00
|
|
|
}
|
2020-02-11 21:39:15 +08:00
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
.item4{background:LightPink;}
|
|
|
|
.item5{background:PaleGreen;}
|
2020-02-11 21:39:15 +08:00
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
.container {
|
|
|
|
font-size: 40px;
|
|
|
|
min-height: 300px;
|
|
|
|
width: 100%;
|
|
|
|
background: LightGray;
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr 1fr;
|
|
|
|
grid-template-rows: 1fr 1fr 1fr;
|
|
|
|
grid-gap: 10px;
|
|
|
|
}
|
|
|
|
</style>
|
2020-02-11 21:39:15 +08:00
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
<div class="container">
|
|
|
|
<div class="item1">1</div>
|
|
|
|
<div class="item2">2</div>
|
|
|
|
<div class="item3">3</div>
|
|
|
|
<div class="item4">4</div>
|
|
|
|
<div class="item5">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
|
|
|
|