CSS – ellipsis – limit text on a div to a specific height or limit a line to non-wrap/break

Limit text on a div to a specific height

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

 

Source: http://stackoverflow.com/questions/3922739/limit-text-length-to-n-lines-using-css

Limit a line to non-wrap/break

li {
  overflow: hidden; 
  text-overflow: ellipsis;
  white-space: nowrap;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *


*