I have a row has two text blocks inside, and flexbox is used to make it responsive.
The goal I am trying to achieve is the text length will not exceed 98% of parent container, and the two text blocks should sit next to each other.
For example:
- long text will be :
[longgggggg...*]
- short text will be:
[short* ]
To trim text, I set flex basis of main text to 98%. But after I did that, the asterisk mark is moved to right edge. Is there a way I can make the asterisk mark sit next to the main text?
.container {
display: flex;
flex-direction: row;
justify-content: flex-start;
background: #e3e3e3;
}
.label {
color: #000;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 0;
flex: 1 1 98%;
}
.label-asterisk {
color: #a72e12;
}
<div class="container">
<span class="label">short</span>
<span class="label-asterisk">*</span>
</div>