FIRST CH TOOLS / DESIGN / 62 FLEXBOX & CSS GRID GENERATOR

Flexbox & CSS Grid Generator

Work out your layout CSS by moving the controls, then take the code home. Flexbox covers justify-content, align-items, gap and flex-wrap; Grid covers template columns and rows plus grid-template-areas. Every value you pick explains what it does, and the tool flags the declarations that cannot take effect with your current combination.

Preview

The dashed box is the container (.layout) and the orange boxes are the items. Click a box to edit that item. If the tracks add up to more than the frame, the frame scrolls sideways — the same overflow would happen on a real page.

Container properties (Flexbox)

display

flex makes a full-width block; inline-flex makes a box that sits in a line of text and shrinks to its content.

flex-direction

flex-wrap

justify-content

align-items

align-content

gap (row) 12px
gap (column) 12px
items 4 items
Selected item

flex-grow 0
flex-shrink 1
flex-basis
align-self

order 0
4
Items
1 line
Lines / tracks
0
Container declarations
0
CSS characters
Generated CSS

    
Matching HTML

    
Checks

    To make the type follow the viewport, see the CSS clamp() calculator; for px and rem spacing, the PX ⇄ REM / EM converter; for backgrounds, the CSS gradient generator; and for card shadows, the box-shadow generator.

    How to Use

    1. Choose Flexbox or CSS GridOne row (or one column) with space handed out between the items is Flexbox; rows and columns that must line up is CSS Grid. Loading the nearest preset and editing it is usually the fastest route.
    2. Move the controls and watch the previewEvery value you pick explains itself right below the control. Click a box in the preview to override flex or a span on that item alone. Declarations that cannot take effect are called out, with the reason.
    3. Copy the CSS and the HTMLYou get the container declarations plus only those item declarations that differ from the defaults. Rename .layout to fit your project.

    About This Tool

    Layout CSS eats time in the write / reload / squint / adjust loop. This tool moves the Flexbox and CSS Grid properties — container and item — while updating the preview and the generated CSS together. The preview is drawn by pushing the very declarations that are written out into the element, so the picture on screen and the code you copy can never drift apart. The output contains the container rule plus the item rules that differ from the defaults; defaults such as flex-wrap: nowrap are left out.

    Every property is explained, so it doubles as a way to learn the model. Each change prints a line describing what the property distributes and what the chosen value does. It also points out declarations that cannot work in the current combination: flex-grow leaving no free space for justify-content, align-content with flex-wrap: nowrap, justify-content against a 1fr track. Dead declarations like these are easy to miss in review and tend to survive in a codebase for years.

    grid-template-areas is validated as you type. Per the spec, a value whose rows have different cell counts — or in which a name is not a rectangle — is discarded in full, so one mistyped cell takes the whole layout with it. This tool checks the cell count of every row and the shape each name occupies, and reports the reason before the layout breaks. The generated HTML reuses the area names as class names, so pasting the CSS and the HTML reproduces the same skeleton. Everything runs in your browser; nothing is uploaded.

    Other Tools