Pikkola Layout Lab, tool No. 48

Draw the layout. Copy the CSS.

Rows, columns, spans and names on one side, a live preview on the other, and the code underneath in plain CSS or Tailwind. Every value is a real CSS value, computed in this tab and written out exactly as you see it.

2
grid and flex
5
working presets
0
requests sent

The studio

Grid or flex, by hand

Pick a preset or start from the tracks. Click a cell to change its span and its name, and watch the code follow in real time.

Mode
Width
Presets

Tracksgrid-template

Columns 2
Rows 2

Each box is one track: 1fr, 240px, auto, minmax(200px, 1fr).

Alignmentjustify / align

Selected cell

Name every cell and the export switches to grid-template-areas.

Click a cell in the preview to change how many columns and rows it covers, or to give it a name.

Live preview 900px

Five starts

Layouts worth knowing by heart

Each one opens in the studio with its tracks, spans and names already set, so you can change the parts you need instead of building from nothing.

Dashboard shell

A fixed sidebar, a header strip and the workspace under it. The layout most admin screens open with.

232px 1fr / 64px 1fr

Bento card grid

One tall feature card, two small ones beside it, and a wide feed below. The sizes carry the hierarchy.

1.45fr 1fr 1fr / 1.15fr 1fr

Holy grail

Header and footer, navigation on the left, an aside on the right, and the document in the middle.

196px 1fr 216px / 68px 1fr 52px

Twelve column cards

A twelve column sheet: a hero over four columns and two rows, four cards of four columns each, and a strip across the page.

repeat(12, 1fr) / 3 rows

Centred hero

One column with a maximum width, centred both ways. The rows stay auto, so the content decides its own height.

minmax(0, 640px) / auto

How it reads

Three rules the builder keeps for you

A grid is a set of lines and the spaces between them. These are the rules that decide where a cell can go, and the tool refuses to break them quietly.

01

A span is a rectangle

A cell may cover several tracks in each direction, and it always covers a full rectangle. Grow a span over a neighbour and that neighbour gives way; shrink it and the free position becomes a new cell. Two cells never sit on the same square.

02

1fr divides what is left

A fraction is not a percentage. The fixed tracks and the gaps are taken out first, and what remains is shared by the fr tracks. A 232px sidebar and a 1fr main in a 900px window leave the main 668px, minus the gap.

03

Names must cover every cell

grid-template-areas is a picture of the whole grid, so it can only be written when every cell has a name. Name the last one and the export switches from line numbers to areas, and every child gets one grid-area instead of two coordinates.

What the controls write
Property What it decides Tailwind
grid-template-columns One size per column, in order. The number of tracks is the number of values. grid-cols-[...]
grid-template-areas The names as a picture of the grid, one quoted row per row. [grid-template-areas:...]
grid-column / row Where a cell starts and how far it reaches. The export keeps the span form. col-span-2 row-span-2
gap The space between tracks. Rows and columns can differ. gap-4 gap-x-[18px]
justify-items Where a cell sits inside its own column when it is narrower than the track. justify-items-center
align-items Where a cell sits inside its own row when it is shorter than the track. items-center
flex-basis The size an item asks for before grow and shrink are applied. basis-[120px]
align-self One item overriding the container's align-items for itself. self-end

Questions

Grid or flex, which one?

Use grid when rows and columns both matter and items should line up in two directions. Use flex when the items flow along one line and their size decides the wrapping. A sidebar with a main area is grid. A toolbar of buttons is flex. The studio keeps both, and the export never mixes them.

What does 1fr do next to a fixed size?

The fixed tracks, the gaps and the borders are subtracted from the container first. The fr tracks divide whatever is left in proportion to their numbers, so 1fr and 2fr give the second track twice the free space, not twice the total width.

Why can I not name just one cell?

grid-template-areas draws the entire grid, so every square needs a name or a dot. The builder waits until all cells are named, then writes the template and gives each child a single grid-area. Until then it exports line numbers, which are just as valid.

The export has a min-height. Why?

A fraction row has nothing to fill when the container has no height, so 1fr collapses to the content. The export sets 420px so the result looks like the preview. Delete that line when the container already has a height, such as a full page shell.

Does the browser place cells I have not positioned?

Only the first cell is left to auto flow. Every other cell is written with explicit lines, because auto placement can move a cell when a neighbour changes. Explicit lines are longer but they reproduce the preview exactly.

Is anything sent anywhere?

No. The model, the preview and both writers run in this tab, the content policy sets connect-src to none, and there is no server that could receive a layout. Only the language, the theme and the current layout are kept in this browser.