✨ Flexbox Layout Generator

Pick the key flex properties and immediately get the matching display:flex CSS with a live preview of one, two and three items.

📐 工作原理与说明
display: flex;flex-direction / flex-wrap / justify-content / align-items / gap 组合
把 flex-direction、wrap、justify-content、align-items、gap 等属性拼装为 display:flex 声明,并以 1 / 2 / 3 个项目实时演示排列效果;用于一维布局。

Formula & Standard References

Item Formula / Note Source / Standard
Main and cross axis flex-direction sets the main axis, the cross axis stays perpendicular CSS Flexible Box Layout Level 1
Flex resolution free space follows flex-grow weights, deficits follow flex-shrink CSS Flexible Box Layout Level 1
Alignment justify-content handles the main axis, align-items the cross axis CSS Flexible Box Layout Level 1
⚠️ 使用说明与注意事项

🧩 flex 属性速查

属性常用取值说明
flex-directionrow / column / row-reverse / column-reverse主轴方向
justify-contentflex-start / center / flex-end / space-between / space-around / space-evenly主轴对齐
align-itemsstretch / flex-start / center / flex-end / baseline交叉轴对齐
flex-wrapnowrap / wrap / wrap-reverse是否换行
gap任意长度(如 12px)项目间距

提示:要让单个项目在交叉轴居中可用 align-self;要控制项目伸缩用 flex: 1 或 flex-grow/shrink/basis。