Here is an example snippet of my code:
<div class="container">
<div class="item n1">Proe Schugaienz</div>
<div class="item n2">Proe Schugaienz</div>
</div>
and I am using the following jQuery code:
$('.item').dotdotdot({
wrap: 'word',
fallbackToLetter: false
})
along with this CSS:
.item {
margin: 5px;
background: red;
padding: 2px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.n1 {
width: 8px;
}
.n2 {
width: 80px;
}
However, the result I currently get is not what I expected:
https://i.stack.imgur.com/SFhQF.png
I am aiming for this desired outcome:
https://i.stack.imgur.com/I2CFs.png
Is it possible to achieve this with just CSS or do I need to use dotdotdot.js? I want the text to be truncated with ellipsis if it doesn't fit within its parent container, and avoid letter-hyphenation.
I don't want the height of my container to expand (since I have a lot of data), this is just an example and hardcoding blocks is not an option.