2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
id: 587d78ab367417b2b2512af1
|
2020-12-16 00:37:30 -07:00
|
|
|
title: 在推文中添加弹性盒子布局
|
2018-10-10 18:03:03 -04:00
|
|
|
challengeType: 0
|
2020-02-11 21:32:25 +08:00
|
|
|
videoUrl: 'https://scrimba.com/p/pVaDAv/c9W7MhM'
|
|
|
|
forumTopicId: 301100
|
2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --description--
|
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
我们以右边的嵌入推文为例,一些元素换一个布局方式或许更好看。上一个挑战演示了 `display: flex`,现在你需要把它添加到推文内嵌的多个组件中,调整它们的位置。
|
2020-12-16 00:37:30 -07:00
|
|
|
|
|
|
|
# --instructions--
|
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
请为下列项目添加 CSS 属性 `display: flex`。注意,以下 CSS 选择器已为你写好:
|
2020-12-16 00:37:30 -07:00
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
`header`、header 中的 `.profile-name`、header 中的 `.follow-btn`、header 中的 `h3` 和 `h4`、`footer` 以及 footer 中的 `.stats`。
|
2020-12-16 00:37:30 -07:00
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
`header` 的 `display` 属性值应为 `flex`。
|
2020-12-16 00:37:30 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert($('header').css('display') == 'flex');
|
|
|
|
```
|
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
`footer` 的 `display` 属性值应为 `flex`。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
```js
|
|
|
|
assert($('footer').css('display') == 'flex');
|
2018-10-10 18:03:03 -04:00
|
|
|
```
|
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
`h3` 的 `display` 属性值应为 `flex`。
|
2020-12-16 00:37:30 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert($('h3').css('display') == 'flex');
|
2018-10-10 18:03:03 -04:00
|
|
|
```
|
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
`h4` 的 `display` 属性值应为 `flex`。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
```js
|
|
|
|
assert($('h4').css('display') == 'flex');
|
|
|
|
```
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
`.profile-name` 的 `display` 属性值应为 `flex`。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
```js
|
|
|
|
assert($('.profile-name').css('display') == 'flex');
|
|
|
|
```
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
`.follow-btn` 的 `display` 属性值应为 `flex`。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
```js
|
|
|
|
assert($('.follow-btn').css('display') == 'flex');
|
2018-10-10 18:03:03 -04:00
|
|
|
```
|
2020-02-11 21:32:25 +08:00
|
|
|
|
2021-01-08 11:20:48 -08:00
|
|
|
`.stats` 的 `display` 属性值应为 `flex`。
|
2020-12-16 00:37:30 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert($('.stats').css('display') == 'flex');
|
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|