CSS Flexbox

Flex shrink

flex-shrink is the opposite of the flex-grow property and specifies how much an element is allowed to shrink in the main axis compared to the other sibling elements.

If we set flex-shrink to 0, an element does not shrink in size at all. If flex-shrink is set to the same value for all sibling elements they will shrink when the combined size of the elements is larger than its container and no-wrap has been set.

Code example: no shrinkage

.wrapper {
display: flex;
flex-wrap: no-wrap;
}
.box {
flex-shrink: 0;
flex-basis: 8.0rem;
height: 8.0rem;
}

produces

Notice how overflow is created since the container has disabled flex wrap and elements aren't allowed to shrink.

Code example: even shrinkage

.wrapper {
display: flex;
flex-wrap: no-wrap;
}
.box {
flex-shrink: 1;
flex-basis: 8.0rem;
height: 8.0rem;
}

produces

The elements shrink evenly because they are allowed to and they can't all fit on the same line without creating overflow.

Read more on MDN

flex-shrink