I got a news display section in my web application. I need to show the first 2 lines of news in a div, which is 450px X 30 px height, 15 px line height.
I only need to show the first 2 lines. I did with server side string split like:
$news=$row['news'];
if(strlen($news)>200)
$news=substr($news,0,197).'...';
Its showing "sdasd asdasd ad…" if my news contains more than 200 chars ..
But the real problem is ..
Suppose my news contains more "W’s " then the news will go beyond the div and show "WWWW…"
And if the news contains "i" … Then the 2 lines will not fill even my news contains more than 500 chars …
I would likes to fill my 2 lines with the text and append a "…" if text contains more chars.
It making my application weird look.
I have no idea how to solve this.
I have created the following for a similar issue.
I inserted the text with say 250 chars in a div with overflow:hidden
I then created a div box fixed to the bottom right of the box with … Read More or in your case maybe just the …
I hope this may help with some ideas.