I`m trying to make an icon to be close to the text. The text can have different length. The problem is when there are to much text for 1 line, it breaks text into the new line, but the text block takes the whole space, even if the text breaks earlier. The closest solution is word-break: break-all. But it's not suitable.
It there any other way to change text breaking rule? Or to make something with .text block to end directly where the text breaks?
.block {
display: flex;
width: 125px;
background: grey;
margin-bottom: 10px;
}
.icon {
width: 25px;
height: 25px;
background: red;
}
<div class="block">
<div class="text">text text text text text</div>
<div class="icon"></div>
</div>
<div class="block">
<div class="text">text text</div>
<div class="icon"></div>
</div>