Is there any way to display text in two line and overflow is dotted? I can use
white-space: nowrap;
text-overflow: ellipsis;
But it show the text in one line. I need to show my text in two line and if overflow text then it should show dotted end.
Is there any way to display text in two line and overflow is dotted? I can use
white-space: nowrap;
text-overflow: ellipsis;
But it show the text in one line. I need to show my text in two line and if overflow text then it should show dotted end.
Working CSS solution for Chrome, Safari and Opera is:
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
You can change 2 to any number. It will show X number of text and dots at the end
line-clamp is not supported by all browsers. https://caniuse.com/#search=line-clamp
At css set width of element, white-space to pre
div {
font-size: 1em;
display: inline-block;
width: 2em;
white-space: pre;
text-overflow: ellipsis;
overflow: hidden;
}
<div>lines of
breaks</div>