I'm trying to get an element with display: flex to work with text-overflow: ellipsis so overflown text is truncated with .... The width of the element is defined via its flex-basis from a parent flexbox, see here:
.parent {
display: flex;
min-width: 0;
}
.child {
display: flex;
background: yellow;
flex: 0 0 5em;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
<div class="parent">
<div class="child">
abcabcabcabcabcabcabc
</div>
</div>
I've search similar answers but none seem to cover this exact case. I do not want to introduce any additional elements and I want to keep the display: flex on the element because I need it for vertical centering.