--- id: 5a94fe6269fb03452672e462 title: Create Flexible Layouts Using auto-fit challengeType: 0 videoUrl: '' localeTitle: 使用自动调整创建灵活布局 --- ## Description
auto-fit几乎与auto-fill相同。唯一的区别是,当容器的大小超过所有项目组合的大小时, auto-fill会继续插入空行或列并将项目推向一侧,而auto-fit折叠这些空行或列并将项目拉伸到适合容器的大小。 注意
如果您的容器无法将所有项目放在一行上,则会将它们移动到新行。
## Instructions
在第二个网格中,使用auto-fit repeat以使用最小宽度为60px且最大为1fr列填充网格。然后调整预览大小以查看差异。
## Tests
```yml tests: - text: container2类应该具有grid-template-columns属性,该属性具有repeatauto-fit ,它将使用最小宽度为60px且最大为1fr列填充网格。 testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fit\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi), "container2 class should have a grid-template-columns property with repeat and auto-fit that will fill the grid with columns that have a minimum width of 60px and maximum of 1fr.");' ```
## Challenge Seed
```html
1
2
3
4
5
1
2
3
4
5
```
## Solution
```js // solution required ```