0

Where i am listing the products, i dont want to show the full lead of them, so now i cut it off with max-height:90px.

Its working, but how can add some ...-after the text end? I tryed text-allipsis and white space no-wrap, but in that version, only 1 row text was showned, and not 4.

My code now for the text:

.item_list_text{max-height:90px;overflow:hidden;}

enter image description here

Tibi458
  • 91
  • 2
  • 11

1 Answers1

0

There's a way to do it using unofficial line-clamp syntax, and starting with Firefox 68 it works with all major browsers.

.item_list_text {
   overflow: hidden;
   text-overflow: ellipsis;
   display: -webkit-box;
   -webkit-box-orient: vertical;
   -webkit-line-clamp: N; /* number of lines to show */
}

body {
   margin: 20px;
}

.item_list_text {
  overflow: hidden;
   text-overflow: ellipsis;
   display: -webkit-box;
   -webkit-line-clamp: 3; /* number of lines to show */
   -webkit-box-orient: vertical;
}
<div class="item_list_text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam consectetur venenatis blandit. Praesent vehicula, libero non pretium vulputate, lacus arcu facilisis lectus, sed feugiat tellus nulla eu dolor. Nulla porta bibendum lectus quis euismod. Aliquam volutpat ultricies porttitor. Cras risus nisi, accumsan vel cursus ut, sollicitudin vitae dolor. Fusce scelerisque eleifend lectus in bibendum. Suspendisse lacinia egestas felis a volutpat.
        </div>

Unless you care about IE users, there is no need to do line-height and max-height fallbacks.

Community
  • 1
  • 1
Awais
  • 4,752
  • 4
  • 17
  • 40