--- id: 5a94fe5469fb03452672e461 title: Create Flexible Layouts Using auto-fill challengeType: 0 videoUrl: 'https://scrimba.com/p/pByETK/cmzdycW' forumTopicId: 301126 dashedName: create-flexible-layouts-using-auto-fill --- # --description-- The repeat function comes with an option called auto-fill. This allows you to automatically insert as many rows or columns of your desired size as possible depending on the size of the container. You can create flexible layouts when combining `auto-fill` with `minmax`, like this: ```css repeat(auto-fill, minmax(60px, 1fr)); ``` When the container changes size, this setup keeps inserting 60px columns and stretching them until it can insert another one. **Note:** If your container can't fit all your items on one row, it will move them down to a new one. # --instructions-- In the first grid, use `auto-fill` with `repeat` to fill the grid with columns that have a minimum width of `60px` and maximum of `1fr`. Then resize the preview to see auto-fill in action. # --hints-- `container` class should have a `grid-template-columns` property with `repeat` and `auto-fill` that will fill the grid with columns that have a minimum width of `60px` and maximum of `1fr`. ```js assert( code.match( /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fill\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi ) ); ``` # --seed-- ## --seed-contents-- ```html
1
2
3
4
5
1
2
3
4
5
``` # --solutions-- ```html
1
2
3
4
5
1
2
3
4
5
```