According to the guidelines outlined in the Cross Size Determination:
The used cross size of each flex item is determined based on various factors. For instance, if a flex item has align-self: stretch, its computed cross size property is auto, and both of its cross-axis margins are not auto, then the used outer cross size will be restricted to the limits set by the item’s used min and max cross sizes. However, if these conditions are not met, the used cross size defaults to the item's hypothetical cross size.
If you do not utilize stretch, the hypothetical cross size becomes the defining factor.
To determine the hypothetical cross size of each item, layout calculations are performed using the used main size and available space while treating auto as fit-content.
It is further explained:
Cross size refers to the width or height of a flex container or flex item, depending on the cross dimension. The cross size property is defined as either its width or height property, whichever corresponds to the cross dimension.
In cases where the direction is column-based, the width should be specified with the width property. If it is set to auto
, it will automatically adjust to fit-content
.
For more information on fit-content
, refer to: https://www.w3.org/TR/css-sizing-3/#fit-content-size