CSS - text overflow: display 2 lines of text only

css

Solution

This snippet will help you.

Just Adjust Max-Height and Line-height for the change in font size.

 .limit-2 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-height: 21px;
    max-height: 48px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
 }

Problem

Given a long string of content, I want to display just the first 2 lines of text. The container of this content is fluid and will resize to the browser's width. Regardless of the container's width, I want the text to always only show 2 lines. Is there a way to do this? If there is no way to do the above, is there a way to restrict based on number of characters?

Original source