I have the example where some of the strings are too long and I want them shortened. However, I want to be able to see the entire string when I hover my mouse over it.
.don_single_donatori {
width: 250px;
min-height: 310px;
}
.overview span {
text-overflow: ellipsis;
width: 100px;
white-space: nowrap;
overflow: hidden;
display: inline-block;
}
.overview em {
font-style: normal;
color: #000;
float: right;
}
<div class="don_single_donatori">
<div class="viewport">
<div class="overview">
<p><span>This is my full name which should be shortend</span><em>2.000,00 EUR</em></p>
<p><span>Anonymous</span><em>2.000,00 EUR</em></p>
<p><span>Anonymous</span><em>500,00 EUR</em></p>
<p><span>This is another long name that needs shortening</span><em>2.000,00 EUR</em></p>
<p>Anonymous<em>2.000,00 EUR</em></p>
</div>
Most approaches I found online use two strings, i.e. the text that you hover over with a mouse is seperate from the text you use for a tooltip (like in the post here). But in my case I have the same text. Having two entries for the same text seems redundant.