Menu
PDF Tools
Image Tools
Converters & Utilities
Seller & Print Tools
Accounting & Business
Calculators
Text & Writing Tools
Developer & Web Tools
Creator & Social Tools
Browser Utilities & Games
Document & Design Makers
Text & Developer Tools
Exam & Form Tools

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.

How to use CSS Flexbox Generator online

  1. Pick the direction. Row or column.
  2. Set alignment. Along and across.
  3. Turn wrapping on if needed. And set the gap.
  4. 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?
Set justify-content and align-items both to centre.
What is the difference between justify and align?
Justify works along the main direction, align works across it.
Why does align-content do nothing?
It only works when items wrap onto several lines.
Does gap work in flexbox?
Yes, in all current browsers.
Can I change the number of items?
The preview can show from 1 to 12 boxes.
Can anyone see the text I put into the CSS Flexbox Generator?
No copy is made on a server; the CSS Flexbox Generator runs in your browser.
How do I keep the result of the CSS Flexbox Generator?
Yes. Copy the CSS Flexbox Generator result, or press Use result as input and carry on with the new text.

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.

More tools in Developer & Web Tools →

Search tools