Word Count: 80
  • Post category:RE Collective (21)
  • Post last modified:2022-04-20

This sample CSS code controls the lines of text (not the character number). Very useful to limit the height of the text block not to exceed certain lines.

** Some browsers may need to add: ” visibility: visible; ” in order to display the ellipsis.

selector .premium-blog-entry-title {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4; /*  number of text lines  */
    -webkit-box-orient: vertical;
    height: 99px; /* Get height from Dev Tool  */      
 }

@media (max-width: 767px) {
    selector .premium-blog-entry-title {
        height: auto;   /* single column where alignment across columns is not required */  
    }
} /*  @767   */