How the CSS Grid Generator Builds a Layout
CSS Grid is a two-dimensional layout system: a grid container (display: grid) is divided into COLUMN and ROW tracks at the same time, separated by a gap, and children land in the resulting cells. This generator’s engine (gridEngine.ts) holds the layout as typed track lists — each track being fr, px, %, em, rem, auto, min-content, max-content or minmax(a, b) — plus a row/column gap, and serialises grid-template-columns, grid-template-rows and gap into a copyable .container rule. Tracks can be added or removed (up to 12 each) and the CSS updates deterministically from the inputs.
- Grid is 2-D: it defines columns AND rows simultaneously
- Each track: fr, px, %, em, rem, auto, min-content, max-content, or minmax(a, b)
- fr distributes leftover space; minmax(a, b) sets a floor and ceiling per track
- Row and column gap in px / rem / em / %
- Pure and deterministic — the same track lists always emit the same CSS
