Flexulator

Star

View on 🖥️ 💻 to use the visual flexulator!

Take all the sizes from the flex items and add them up. If this total flex basis is less than the parent container, the remaining space will be distributed amongst the items.

The flex-grow attribute is used to determine how the remaining space should be allocated. Think of flex-grow as a mulitplier which will increase the amount of space it will get in the final calculation.

The worked example uses the first flex item. Container width, total basis, and remaining space include every item. Grow share, shrink factor, and final width are that one item's — open an Item Card to see a sibling.

1

Flex Container Remaining Space

Container Width
-
Total Flex Basis
=
Remaining Space

2

Calculate Flex Grow Space

(/ = ) (Item Grow / Total Grow)
*
Remaining Space
=
Allocated Space

3

Compute Final Width

Allocated Space
+
Item Flex Basis
=
Final Width

Take all the sizes from the flex items and add them up. If this total flex basis is greater than the parent container, each flex-item will have to reduce it's size to fit.

The flex-shrink attribute determines how much space is given up by the flex-item. Unlike flex-grow, the flex-shrink value controls how much space is given up. Increasing the flex-shrink will reduce the size of the flex-item relative to its siblings.

The worked example uses the first flex item. Container width, total basis, and remaining space include every item. Grow share, shrink factor, and final width are that one item's — open an Item Card to see a sibling.

1

Flex Container Remaining Space

Container Width
-
Total Basis
=
Remaining Space

2

Calculate Shrink Factor

(/) (Item Shrink * Item Basis) = Item Shrink Basis Total
/
Shrink Basis Total
=
Shrink Factor

3

Allocated Shrink Amount

Shrink Factor
*
Remaining Space
=
Shrink Amount

4

Compute Final Width

Item Basis
-
Shrink Amount
=
Final Width