One of the junior colleagues has been fiddling and ask for an explanation. I realize that while understanding the general issue, I can't explain why the specific behavior occurs.
As the fiddle shows, the orange parts are equally wide. But the class linky is set to flex: 1 1 0 which means that the contained items should grow and shrink as needed withing the container limits. I can't explain why the short one grows needlessly nor why the long ones don't make the green parent classed holder spread wider.
div.holder {
display: flex;
flex: 1 1 0;
align-items: center;
border: 4px solid greenyellow;
}
div.linky {
display: flex;
flex: 1 1 0;
overflow: hidden;
white-space: nowrap;
border: 4px solid orange;
}
Finally, we want the orange ones to be just-enough-wide (wrt the text's length in each of them individually) while there's space in the green one. Otherwise, we want them to stop growing, hiding the overflowing content.
However, we're not looking for a fish but rather the rod here, so understanding the reason why the expected behavior didn't occur is the main point.
I've revised the CSS Tricks' on FlexBox and found extensive elaborations. Regrettably, I have to admit that I can't explain the fiddled behavior in our case. I've tried setting minimum width to 0 and auto, turning on/off display flex and numerous (all?) combinations of the grow/shrink parameter. No luck.
edit
Based on the helpful comments by @temaniafif I have created a new fiddle that performs better on excess of space but still doesn't shrink the elements despite them getting too wide.
My (obviously faulty) reasoning is like this. I want the holder to snatch all the positive space, shrink itself on negative space and have initial width based on its contents. So flex: 1 1 auto
. I want the linky never to greed on excess of space, shrink itself when the space is limited and not to shrink itself to nothing (keeping it tight around itself). So flex: 0 1 auto
.