css set number of lines code example
Example 1: restrict a paragraph height css
.class{
word-break: break-word;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
line-height: 16px;
max-height: 32px;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
Example 2: restrict a paragraph height css
body {
margin: 20px;
}
.text {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
Example 3: 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;
max-height: 32px;
}