CSS Flexbox Generator
Experiment with CSS flexbox visually. Set direction, wrap, justify-content, align-items, align-content, gap and size, adjust grow, shrink and basis, edit individual items, see the main and cross axes, and copy the CSS.
Experiment with CSS flexbox visually. Set direction, wrap, justify-content, align-items, align-content, gap and size, adjust grow, shrink and basis, edit individual items, see the main and cross axes, and copy the CSS.
CSS Flexbox Generator is a visual playground for flexbox. A container with numbered sample items responds instantly as you change flex-direction, flex-wrap, justify-content, align-items, align-content, gap and the container’s width and height. You can also set flex-grow, flex-shrink and flex-basis for all items and change how many sample items there are.
Turn on single-item editing, or simply select an item in the preview, to give that item its own order, align-self, grow, shrink or basis. A small explanation panel shows which way the main axis and cross axis run for the current direction and wrap settings, and which properties act along each. The generated CSS stays concise: the container rule, an item rule only when the shared item values differ from the default, and nth-child rules only for items you changed. All values come from fixed menus and range-checked numbers.
The main axis follows flex-direction: horizontal for row and row-reverse, vertical for column and column-reverse. The cross axis runs at right angles to it. justify-content and flex-grow/shrink/basis act along the main axis; align-items, align-self and align-content act across it.
align-content spaces out lines of items, so it only has a visible effect when flex-wrap is wrap or wrap-reverse and the items actually wrap onto more than one line, with spare space in the container.
Select the item in the preview, or tick Edit a single item and pick it from the list. You can then set its order, align-self, flex-grow, flex-shrink and flex-basis. Clear This Item removes its overrides.
A .container rule with the container settings, an .item rule when the shared grow/shrink/basis differ from the default 0 1 auto, and .item:nth-child(n) rules only for items you customised.
order changes only the visual order. Screen readers and keyboard focus still follow the order in the HTML, so avoid using order for content where the sequence matters.
The generated properties are standard flexbox supported by all current major browsers. The tool does not add legacy prefixes or target very old browsers.