CSSフレックスボックス・ジェネレーター
Build flexbox layouts visually · adjust container & item properties, see live preview, copy the CSS.
Container Properties
Live Preview
Generated CSS
How It Works
- Set container properties: Configure the flex container — flex-direction, justify-content, align-items, flex-wrap, and gap.
- Add and configure flex items: Add child elements and set individual flex-grow, flex-shrink, flex-basis, align-self, and order values.
- Copy the CSS: Get the complete container and item CSS ready to use in your project.
Why Use Flexbox Generator?
Flexbox is the essential tool for one-dimensional CSS layout — aligning items in a row or column with powerful distribution and alignment controls. But the properties are numerous and their interactions complex: justify-content vs align-items, flex-grow vs flex-basis, main axis vs cross axis. This interactive generator provides instant visual feedback as you toggle each property, making it the fastest way to learn Flexbox and get working CSS for your specific layout.
Features
- Interactive preview: Drag flex items and toggle properties to see layout changes in real time.
- All container properties: flex-direction, flex-wrap, justify-content, align-items, align-content, and gap.
- Per-item control: Set flex-grow, flex-shrink, flex-basis, align-self, and order for each item individually.
- Visual axis indicators: Main axis and cross axis are highlighted to reinforce the conceptual model.
- CSS output: Complete, copy-ready CSS for both the container and all configured items.
Frequently Asked Questions
What is the difference between justify-content and align-items?
justify-content distributes items along the main axis (horizontal by default). align-items aligns items along the cross axis (vertical by default). When flex-direction is column, the axes swap — justify-content becomes vertical and align-items becomes horizontal.
When should I use Flexbox vs CSS Grid?
Use Flexbox for one-dimensional layouts — a row of buttons, a navigation bar, a list of cards that should wrap. Use CSS Grid for two-dimensional layouts where you need to control both rows and columns simultaneously, like a full page layout or a complex card grid.
What does flex: 1 mean?
flex: 1 is shorthand for flex-grow: 1; flex-shrink: 1; flex-basis: 0%. It tells the element to grow to fill available space, shrink if needed, and start from zero size before distributing space. All items with flex: 1 share space equally.