Gotcha: Item Widths in a Flex Container

By default, flex items only take up as much space as their content needs. If you want them to fill the available space, you need to use utility classes like flex-grow or specific width classes (e.g., w-1/3 ).

Default Behavior (Items don't fill width)

Short
Medium Content
Very Long Content Item Example

Using flex-grow to fill space

Applying flex-grow to child items allows them to expand and fill available horizontal space.

Item 1 (flex-grow)
Item 2 (flex-grow)
Item 3 (flex-grow)

Using Fractional Widths (e.g., w-1/3 )

You can also assign specific widths to children. For this to work as expected in a flex row where you want them to sit side-by-side and sum up to the full width, ensure they don't overflow (or use flex-shrink-0 if you don't want them to shrink).

1/3 Width
1/3 Width
1/3 Width

Key Takeaway for Widths: