What does grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) do?

Prepare for the CSS Mastery Recipient Portal Test. Study with comprehensive questions and in-depth explanations. Enhance your CSS skills and ace your test!

Multiple Choice

What does grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) do?

Explanation:
This setup makes the grid responsive by creating as many columns as fit in the container, with each column at least 200px wide and allowed to grow to fill the remaining space evenly. The repeat(auto-fill, minmax(200px, 1fr)) part determines how many tracks (columns) are created based on the container’s width. Each track uses the size spec minmax(200px, 1fr): the column can’t be narrower than 200px, but when there’s extra horizontal space, all columns share it equally thanks to the 1fr fractional unit. So as the container gets wider, the grid adds more columns up to the space available, and existing columns widen to use leftover space. Note that if there aren’t enough items to fill every created column, extra (empty) columns still exist and can stretch, which is a normal behavior of auto-fill with flexible tracks. In short, you get multiple columns that stay at least 200px but expand to fill the row, automatically wrapping as needed.

This setup makes the grid responsive by creating as many columns as fit in the container, with each column at least 200px wide and allowed to grow to fill the remaining space evenly.

The repeat(auto-fill, minmax(200px, 1fr)) part determines how many tracks (columns) are created based on the container’s width. Each track uses the size spec minmax(200px, 1fr): the column can’t be narrower than 200px, but when there’s extra horizontal space, all columns share it equally thanks to the 1fr fractional unit. So as the container gets wider, the grid adds more columns up to the space available, and existing columns widen to use leftover space.

Note that if there aren’t enough items to fill every created column, extra (empty) columns still exist and can stretch, which is a normal behavior of auto-fill with flexible tracks.

In short, you get multiple columns that stay at least 200px but expand to fill the row, automatically wrapping as needed.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy