Currently, I have a div with a set height.
<div class="card yellow-task task" style="height: 255px;">
<div class="div-content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.....
</div>
</div>
Assuming the text (when wrapped throughout the height of the div) is longer than the div can contain how would I truncate the text using CSS?
The code I am currently using uses a -webkit-line-clamp
and ellipsis
to truncate the text based off of lines.
display: block;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
Unfortunately, I have no way of knowing how many lines are in each div. This is a problem as the divs are being generated dynamically based off of other properties with angular js and ng-repeat
.