CSS Limit Text to N Lines

May 31, 2020

The following CSS limit text to 3 lines

.text-content {
    line-height: 1.5em;
    max-height: 4.5em;  /* max-height = line-height * num of lines
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.