How to use the Tailwind Flexbox Generator
Flexible Box Layout (Flexbox) is a one-dimensional layout method for arranging items in rows or columns. This generator helps you visualize how various Flexbox properties affect the layout and generates the corresponding Tailwind CSS utility classes.
Container vs. Item Properties
Flexbox distinguishes between the parent container (flex container) and its direct children (flex items). Most controls in this tool affect the container, such as direction and alignment.
Direction and Wrap
The flex-direction property defines the main axis. row (default) places items horizontally, while col stacks them vertically. flex-wrap controls whether items should wrap to a new line if they exceed the container's width.
Understanding Alignment
- Justify Content: Aligns items along the main axis.
- Align Items: Aligns items along the cross axis.
- Align Content: Defines how lines are aligned when wrapping is active.
Individual Item Customization
By clicking on an item in the preview, you can adjust its individual behavior: Flex Grow (how it expands), Flex Shrink (how it contracts), Order (visual sequence), and Align Self (overriding container alignment).