How to Use the CSS Grid Generator: Steps and a Worked Example
Generate a CSS grid container with equal-width columns. This guide shows what to enter, a worked example, and the limits to keep in mind. The CSS Grid Generator tool is free, needs no account and runs in your browser.
What you need
- Columns, for example 3
- Gap (px), for example 16
Step by step
- Open the CSS Grid Generator tool.
- Fill in Columns.
- Fill in Gap (px).
- Read the result, which updates as soon as the inputs change.
Worked example
With these inputs:
- Columns: 3
- Gap (px): 16
the tool returns:
.container {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 16px;
}
A second example
Changing Columns 3 to 6 gives:
.container {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
gap: 16px;
}
Comparing two runs like this is a quick way to see how much each input moves the result.
How it works
Enter the number of columns and the gap. Columns use minmax(0, 1fr) so long content cannot stretch them.
Things to keep in mind
Check your inputs, units and any local rules before you rely on the result.
Related tools
If this is not quite what you need, try CSS Border Radius Generator, CSS Box Shadow Generator or CSS Color Extractor.