I am working on achieving a specific layout as shown in the screenshot below.
- If both SPAN and B fit within the box, they should be displayed one after another.
- If they do not fit, SPAN should have an ellipsis while B is fully displayed (never larger than the block).
Even when attempting to include B within SPAN or using nested tables, I have not been successful in achieving the desired result.
Expected outcome:
https://i.sstatic.net/cIuV6.png
Initial snippet:
div {
width: 200px;
white-space: nowrap;
border: 1px solid red;
margin-top: 10px;
}
span {
overflow: hidden;
text-overflow: ellipsis;
}
b {
padding-left: 10px;
}
<div>
<span>test</span>
<b>12345</b>
</div>
<div>
<span>test test test test test test test test test test test</span>
<b>50</b>
</div>