Flexbox distributes items along a single axis, main and cross, and handles nearly every navbar, button list and content column alignment.
`flex-direction` sets the main axis (row or column) and is the first decision in any flex layout. `justify-content` aligns items along the main axis, `align-items` aligns along the cross axis, and `align-content` only comes into play once `flex-wrap: wrap` is active and there is more than one line of items. At the item level, `flex-grow` controls how much it grows to fill leftover space (0 means it never grows), `flex-shrink` controls how much it shrinks when space is tight, and `flex-basis` sets the starting size before grow/shrink kick in, generally more predictable than using `width` directly. The `order` property changes an item's visual position without touching the actual HTML order, items with a lower `order` appear first, the default for every item is 0.
How to use
Configure the container, then fine-tune each item individually.
Pick a preset or set direction, wrap, justify-content, align-items and gap on the container.
Click an item in the preview to select it and adjust grow, shrink, basis, align-self and order. Drag items to reorder them visually.
Copy the container and per-item CSS, or switch to Tailwind whenever the configuration has an equivalent on the default scale.
Embed
Use this tool on your site
Paste the code into your HTML and the tool shows up on your page, without J-Kit's navigation and ads. It still runs in the browser of whoever visits your site.
These references help contextualize formulas, standards, APIs and limitations used on this page. They do not replace professional validation when a result has legal, financial, medical or operational impact.
justify-content aligns items along the main axis (set by flex-direction), align-items aligns along the cross axis, perpendicular to the main one. With `flex-direction: row`, justify-content controls horizontal alignment and align-items vertical, in `column` the two swap.