Toolstia / CSS flexbox generator

CSS flexbox generator

Pick the flexbox properties from dropdowns and watch the preview rearrange. When it looks right, copy the CSS for your container.

1
2
3
4
5

Only the properties you change from their defaults are written out. align-content only has an effect when items wrap onto more than one line.

How it works

  1. Choose direction, wrap, justify-content, align-items and align-content.
  2. Set the gap and how many items to preview.
  3. Copy the CSS.

Main axis and cross axis

Flex-direction sets the main axis. Justify-content spreads items along it, while align-items places them across it. Switching to column swaps the two.

Wrap and align-content

Items squeeze onto one line unless you allow wrapping. Align-content only does anything when wrapping has produced more than one line.

Gap

The gap property adds space between items without margins on the items themselves.

Clean output

Properties left at their default value are not written, so the CSS stays short.

Questions

Does it make the item rules too?

No. It covers the container. Item properties such as flex-grow depend on your layout.

Why do items in the preview have different heights?

So you can see how align-items behaves. Your real items will use their own sizes.

Is anything uploaded?

Everything happens in your browser, and nothing you enter is sent anywhere.