Truncate text if it atempts to run into three lines
Posted
by Jigs
on Stack Overflow
See other posts from Stack Overflow
or by Jigs
Published on 2010-05-25T20:10:10Z
Indexed on
2010/05/25
20:11 UTC
Read the original article
Hit count: 230
I have a small
about 140px wide aligned next to a picture. In total there is space for four lines of text. The first two lines are reserved for the title and there are two lines of other info.
I want the title to be cut if it spans more than two lines else it will push the other info out of line with the bottom of the image.
The only solution I could think of was to create a div the height of two lines with an overflow to hidden. However, if the title is only one line it leaves a big gap.
The solution can be Jquery, plain javascript, CSS or even PHP (if its possible).
TIA
© Stack Overflow or respective owner