2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: 5a9036ee38fddaf9a66b5d35
|
2020-12-16 00:37:30 -07:00
|
|
|
|
title: 使用 grid-column-gap 创建多列之间的间距
|
2018-10-10 18:03:03 -04:00
|
|
|
|
challengeType: 0
|
2020-02-11 21:39:15 +08:00
|
|
|
|
videoUrl: 'https://scrimba.com/p/pByETK/cVZ8vfD'
|
|
|
|
|
forumTopicId: 301124
|
2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --description--
|
2020-02-11 21:39:15 +08:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
到目前为止,在你所建立的网格中列都相互紧挨着。如果需要在列与列之间添加一些间距,我们可以使用`grid-column-gap`:
|
2020-02-11 21:39:15 +08:00
|
|
|
|
|
|
|
|
|
```css
|
|
|
|
|
grid-column-gap: 10px;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
这会在我们创建的所有列之间添加 10px 的空白间距。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --instructions--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
为网格中的列添加宽度为`20px`的间距。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --hints--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
`container`类应该有`grid-column-gap`属性且值为`20px`。
|
2020-02-11 21:39:15 +08:00
|
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
|
```js
|
2020-12-16 00:37:30 -07:00
|
|
|
|
assert(
|
|
|
|
|
code.match(
|
|
|
|
|
/.container\s*?{[\s\S]*grid-column-gap\s*?:\s*?20px\s*?;[\s\S]*}/gi
|
|
|
|
|
)
|
|
|
|
|
);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
```
|
2020-02-11 21:39:15 +08:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --solutions--
|
|
|
|
|
|