...

/

flex-grow, flex-shrink, flex-basis, and flex Properties

flex-grow, flex-shrink, flex-basis, and flex Properties

Learn about the flex-grow, flex-shrink, flex-basis, and flex properties of flexbox.

We'll cover the following...

Growing and shrinking zombies

flex-grow: This lets you set a growth factor that allows items to grow to fill the space (either horizontally or vertically, depending on flex-direction). The growth factor is a positive, rational number and is not a direct multiplier for the width/height. Rather, when the flex algorithm looks at the remaining space available in a row or column, it calculates how to apportion space based on the flex-grow factors. A higher value means that that item is likely to get more space than those with a lower value. The default is 0, which means the item won’t grow at all. Negative numbers are invalid.

.zombie-item {
    flex-grow: 1.5;
}

flex-shrink: This lets you set a shrink factor for when flex items are too wide or tall for their containers (depending on ...