Building a grid
Container size
By default the grid takes the width of its parent and is as tall as its content. Set a width or height when you need something else.
Width and height #
In Container size, type a value into Width or Height. Leave a box empty to leave that property out of the CSS.
Accepted values:
- Lengths and percentages:
960px,100%,60rem,100vh,80vw - Keywords:
auto,min-content,max-content,fit-content
A value like 1fr isn't valid here (fr only works for tracks). GridFlow shows a message and keeps the last valid value.
When height matters #
Rows sized in fr share the container's free height. Without a set height, there is no free height, so 1fr rows are only as tall as their content. To make a page-height layout, such as a footer that stays at the bottom, set the height to 100vh, or use min-height: 100vh in your own CSS.
In the preview, a 100vh height means the height of your browser window, so the preview can become taller than its panel. Scroll inside the preview to see it all.
In the code #
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: auto 1fr auto;
gap: 16px;
width: 100%;
height: 100vh;
}