CSS Grid Generator

CSS Grid Generator lets you set grid-template-columns and grid-template-rows, gaps and alignment properties, see them in a live preview and copy clean Grid CSS. Presets such as 3 columns, a sidebar layout, holy grail and auto-fill give you a starting point.

Presets
Items: 6
1
2
3
4
5
6
.container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 100px);
  gap: 12px;
}

How it works

  1. 1Pick a preset or write the column and row track lists (e.g. repeat(3, 1fr)).
  2. 2Adjust the gaps and alignment and change the item count to preview.
  3. 3Copy the CSS with "Copy CSS".

Frequently asked questions

What is the fr unit?+

It represents a share of the remaining free space; with 1fr 2fr the second column gets twice the width of the first.

What is the difference between auto-fill and auto-fit?+

auto-fill keeps empty tracks while auto-fit collapses them and stretches the filled ones; you can type either in the track list.

Why are some values rejected?+

For safety the track list only accepts sizes, functions and operators; input with braces, semicolons or url() is rejected.

Embed on your site

Size
480 × 360px
<iframe
  src="https://toolsqube.com/en/color/css-grid-generator/embed"
  width="480" height="360"
  style="border:0;border-radius:14px"
  title="CSS Grid Generator · ToolsQube"
  loading="lazy">
</iframe>

Want to go deeper on this topic: Color and Design Guide →

Command Palette

Search for a command to run…