Flexbox Generator
Arrange a real flex layout. Tune the container and each item, try different widths, then take the CSS, HTML, or Tailwind markup.
Live preview
960 × 320 px · Select an item in the preview to edit it.
Items
Up to 12 items. At least one item is required.
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-items: stretch;
align-content: stretch;
gap: 16px;
padding: 24px;
height: 320px;
box-sizing: border-box;
}
.item-1 {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 180px;
order: 0;
align-self: auto;
min-width: 0;
padding: 16px;
box-sizing: border-box;
border-radius: 12px;
overflow-wrap: anywhere;
background: #dbeafe;
color: #172554;
}
.item-2 {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 180px;
order: 0;
align-self: auto;
min-width: 0;
padding: 16px;
box-sizing: border-box;
border-radius: 12px;
overflow-wrap: anywhere;
background: #bfdbfe;
color: #172554;
}
.item-3 {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 180px;
order: 0;
align-self: auto;
min-width: 0;
padding: 16px;
box-sizing: border-box;
border-radius: 12px;
overflow-wrap: anywhere;
background: #93c5fd;
color: #172554;
}Everything stays in your browser.
How to use
- Choose a layout template or start with the cards example.
- Adjust the container and select an item to edit its size, order, and alignment.
- Try desktop, tablet, and mobile widths, then copy the generated code.
Example
display: flex; flex-wrap: wrap; gap: 16px;
Details and limitations
The preview and exports share the same layout styles, including a 320 px container height and 24 px padding.
Preview widths are 960, 768, and 375 px. On small screens the stage scrolls horizontally; it does not shrink the simulated viewport.
Tailwind exports use arbitrary properties. CSS order changes visual order, while the move buttons change document order. Keep reading and keyboard order in mind.
Align content affects multiple flex lines only. A single line uses align items.
Related tools
Format references
Tool page updated: