i need to display a list of cards in a component, each card has a description coming from the server. In my component.html
, I am using a ngFor
like this:
<div [style.background-image]="'url('+row.companyId?.coverUrl+')'" class="img-area">
</div>
<div class="card-content-area">
<p class="card-title cursor-pointer" (click)="navigateToCOmpany(row)">{{row.companyId.name}}</p>
<div class="card-description-area">
<p class="site-text">{{row.offer_desc}}</p>
</div>
<a (click)="referralClick(row, i)" class="site-btn show-desktop-block">Get referral link</a>
<a (click)="referralClick(row, i)" class="site-link-mobile show-mobile-block"><i class="fa fa-link mobile-link" aria-hidden="true"></i> Get Referral link</a>
</div>
The {{row.offer_desc}}
field contains descriptions of varying lengths. Some have 2 lines while others have 4 lines.
https://i.stack.imgur.com/dGHDb.png
Here is my CSS:
.card-description-area {
min-height: 102px !important;
max-height: 102px;
overflow: hidden;
margin-bottom: 10px;
display: -webkit-box !important;
-webkit-box-orient: vertical !important;
-webkit-line-clamp: 1 !important;
}
.site-text {
font-size: 16px !important;
font-family: 'Muli', sans-serif !important;
line-height: 24px !important;
}
I want to add text ellipses (...) at the end of the truncated text. Though I'm hiding the overflow text, I also want to indicate that more text exists by adding ellipses at the end. However, due to dynamic length of lines, I haven't been able to achieve this using only CSS and Angular 7.
Any suggestions on how I can accomplish this?