--- id: 5a90376038fddaf9a66b5d3c title: Align All Items Horizontally using justify-items challengeType: 0 videoUrl: '' localeTitle: 使用对齐项目水平对齐所有项目 --- ## Description
有时您希望CSS Grid中的所有项目共享相同的对齐方式。您可以使用以前学过的属性并单独对齐它们,也可以使用网格容器上的justify-items将它们全部水平justify-items 。此属性可以接受您在前两个挑战中学到的所有相同值,不同之处在于它会将网格中的所有项目移动到所需的对齐方式。
## Instructions
使用此属性可以水平居中所有项目。
## Tests
```yml tests: - text: container类应该有一个具有center值的justify-items属性。 testString: 'assert(code.match(/.container\s*?{[\s\S]*justify-items\s*?:\s*?center\s*?;[\s\S]*}/gi), "container class should have a justify-items property that has the value of center.");' ```
## Challenge Seed
```html
1
2
3
4
5
```
## Solution
```js // solution required ```