I'm seeking assistance with understanding how to solve a particular issue. I have multiple list elements with varying lengths of text content, each flanked by small images/icons on either side. Below is an example of the HTML structure:
.truncate>img {
width: 25px;
height: 25px;
}
.truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
Content
</div>
<div class="col-sm-4">
<ul id="myList" class="list-group">
<li class="list-group-item" value="">
<div class="truncate">
<img src="https://cdn3.iconfinder.com/data/icons/softwaredemo/PNG/128x128/Close_Box_Red.png">A long text string that is about this length
<img src="http://www.clker.com/cliparts/1/5/4/b/11949892282132520602led_circle_green.svg.med.png">
</div>
</li>
<li class="list-group-item" value="">
<div class="truncate">
<img src="https://cdn3.iconfinder.com/data/icons/softwaredemo/PNG/128x128/Close_Box_Red.png">A long text string that is about this length
<img src="http://www.clker.com/cliparts/1/5/4/b/11949892282132520602led_circle_green.svg.med.png">
</div>
</li>
<li class="list-group-item" value="">
<div class="truncate">
<img src="https://cdn3.iconfinder.com/data/icons/softwaredemo/PNG/128x128/Close_Box_Red.png">A long text string that is about this length
<img src="http://www.clker.com/cliparts/1/5/4/b/11949892282132520602led_circle_green.svg.med.png">
</div>
</li>
</ul>
</div>
<div class="col-sm-4">
Content
</div>
</div>
</div>
My goal is to have the text truncated with an ellipsis at the end if it exceeds the available width. Despite using text-overflow: ellipsis, the text gets cut off before the right image. Here are some methods I've attempted:
Enclosing the entire li element in a div and utilizing display: inline-block
Placing the image tags and text within a single div with inline-block which yielded closer results.
Putting the text in a span element and applying different CSS styles.
However, the right image continues to drop below the text each time.
Desired Outcome:
https://i.sstatic.net/p6PFM.png
Actual Outcome:
https://i.sstatic.net/Z07KD.png
Feel free to let me know if additional information is required. Thank you in advance for any suggestions or advice.