CSS Flexbox Generator
This tool writes CSS flexbox rules from the options you pick: direction, wrapping, alignment and gap. A preview shows how the boxes line up.
- Free, no sign-up
- Nothing is sent to a server
- Worldwide
How to use CSS Flexbox Generator online
- Pick the direction. Row or column.
- Set alignment. Along and across.
- Turn wrapping on if needed. And set the gap.
- Copy the CSS. Paste it into your stylesheet.
Why use this free CSS Flexbox Generator
- Four directions
- Wrap or no wrap
- Six spacing choices
- Four cross alignments
- Gap setting
- Live preview
What flexbox does
Flexbox lines items up along one direction and lets the container decide how to spread them. It is the usual choice for toolbars, menus, rows of cards and for centring things. The property names can be hard to remember, so this tool lists the options in words and writes the rules for you.
Main axis and cross axis
Direction sets the main axis: row runs across, column runs down, and the reversed forms flip the order. Justify-content spreads items along the main axis, from the start, centre or end, or with space between, around or evenly. Align-items places them across, at the start, centre or end, or stretches them to fill the height of the line.
Wrapping and rows
With no wrap, items stay on one line and shrink if they do not fit. With wrap, extra items move to a new line. When the container wraps, align-content decides how the lines share the free space across, with the same choices as justify-content. That option appears only when wrapping is on.
The preview
The preview uses boxes of 70 by 50 pixels in a 420 by 220 pixel container. The boxes do not grow, and they shrink only when the line is full and wrapping is off. A real page, with items that grow, have other sizes or use margins, will differ in detail, but the effect of each option is the same.
Tips
To centre one item in both directions, use centre for both justify and align. To push a last item to the far end, a margin on it often works better than space-between. Use gap for spacing between items instead of margins, so the first and last items stay flush with the edge.
Using the tool
The result shows under the boxes and refreshes as you edit. Undo and redo step back through your earlier text.
CSS Flexbox Generator: frequently asked questions
How do I centre something with flexbox?
What is the difference between justify and align?
Why does align-content do nothing?
Does gap work in flexbox?
Can I change the number of items?
Can anyone see the text I put into the CSS Flexbox Generator?
How do I keep the result of the CSS Flexbox Generator?
Related searches for CSS Flexbox Generator
- CSS Flexbox Generator online
- free CSS Flexbox Generator
- CSS Flexbox Generator online free
- CSS Flexbox Generator for mobile
- CSS Flexbox Generator without sign up
- CSS Flexbox Generator – Developer & Web Tools
CSS Flexbox Generator is a free online tool on MAITBOX, in the Developer & Web Tools group. It runs in your browser, so what you type is not sent to a server. It works on Android and iPhone, and on Windows, Mac and Linux, with no download and no account.