Building a grid

Track sizes

Each column and row has its own size. Mix fixed, flexible and content-based sizes to get the layout you want.

Set a size #

Under Column sizes and Row sizes there is one box per track, numbered from 1. Type a size, or pick one from the suggestions that appear as you type. The preview and code update as soon as the value is valid.

To give every column or row the same size at once, type it into Set every column or Set every row and click Apply (or press Enter).

Supported values #

ValueMeaning
1fr, 2frA share of the free space. A 2fr track gets twice as much as a 1fr track.
200pxA fixed size.
25%A share of the container's size.
10rem, 12em, 20vw, 50vh, 30chOther CSS length units.
autoFits the content, and grows into free space when there is no fr track.
min-contentAs small as the content allows, for example the longest word.
max-contentAs wide as the content wants, with no wrapping.
minmax(100px, 1fr)Never smaller than the first value, never larger than the second.
minmax(0, 1fr)An equal share that is allowed to shrink below its content. Useful for card grids.
fit-content(300px)Fits the content, up to the given limit.

When a value isn't valid #

If you type something GridFlow can't use, such as 12xp or 1 fr, the box turns red and a message names the track and suggests valid values. The previous valid size stays in use, so the code never contains invalid CSS. When you leave the box, it goes back to the size in use.

Note: In minmax(min, max), the first value can't be an fr value. minmax(1fr, 2fr) is invalid CSS, so GridFlow rejects it.

How repeat() is written #

Runs of identical sizes next to each other are grouped with repeat(). Sizes are never reordered.

/* Sizes: 200px, 1fr, 1fr, 1fr, 200px */
grid-template-columns: 200px repeat(3, 1fr) 200px;