I have some long text that is displayed within a div this div has a fixed width and height. I want the text to be displayed on a few lines (as the div height) and that the sentence words will not break (word prefix in one line and the continue in the next line) furthermore I want to add ellipsis at the end of the last sentence.
CSS:
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
but this displays the text in one line even though the div contains a few lines.
Second option:
word-wrap: break-word;
this unlike the first break the word and the sentence is displayed in a few lines - this is no good since the words are breaking in the middle and at the end of the sentence there is no ellipsis (...)
How can i achieve the following:
1) Few sentences as the div height
2) No word break
3) At the end ellipsis is displayed ( last line contains ellipsis)
attached jsfiddle: https://jsfiddle.net/vghup5jf/1/ as you can see only one line is displayed
ellipsiswont work for multiple line and its not possible with pure CSS. Below is the trick which works on chrome and Safari (-webkitrendering engines).for cross compatibility you should use SASS or javascript.
https://css-tricks.com/line-clampin/
http://codepen.io/martinwolf/pen/qlFdp