Design rows and columns together
CSS Grid is useful when items need to align across both rows and columns. It can handle a card gallery, an editorial page, or a dashboard with several regions. Begin with the content’s minimum comfortable width, then choose how many tracks fit at each screen size.
How to use this tool
- Set the number of columns and rows, then adjust their sizes. Fractional units share remaining space between tracks.
- Use gap for consistent spacing and place items across tracks only when the content needs a larger region.
- Copy the container and item CSS. Reduce the column count at narrow widths and test a long heading in each card.
This variation creates as many 260-pixel columns as will fit, then shares extra space. The inner min() prevents the minimum track from exceeding a very small container. Auto-fit collapses empty tracks when there are fewer cards.
Read the reference documentation ↗