html - Display up to 3 rows of a text field -


goal: i'd display 3 lines of long text field in <div> of defined width.

current flawed approach:

<style>   div{      width:50%;     height:100px;     padding:10px;     white-space:normal;     overflow:hidden;     text-overflow:ellipsis;     -o-text-overflow:ellipsis;   } </style>   <div>   <%= @company.description %> </div> 

problem: above cuts off bottom line if not lined arbitrary 100px+20px height. so, end line of text halfway cut off horizontally. how can instead display 3 whole lines of text instead of cutting off?

use em, not px height. 3em or 3.12em right (cater padding well).


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -