Css Max Lines

css max lines
.text {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2; /* number of lines to show */
-webkit-box-orient: vertical;
}
restrict a paragraph height css
body {
margin: 20px;
}

.text {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2; /* number of lines to show */
-webkit-box-orient: vertical;
}
restrict a paragraph height css
.class{
word-break: break-word;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
line-height: 16px; /* fallback */
max-height: 32px; /* fallback */
-webkit-line-clamp: 2; /* number of lines to show */
-webkit-box-orient: vertical;
}
css n number of lines only
.className{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;

line-height: 16px; /* Height taken by one line */
max-height: 32px; /* (line-height * numberOfLineYouWant) In this case we want 2 lines so we will multiply lineHeight by 2 so 16 * 2 = 32 => 32px */
/* Remember if you have more height then it'll render new line so match height of container with => lineHeight * numberOfLines */
}

 

 

 

Leave a Comment