[thelist] counting rendered lines of text

sbeam sbeam at syxyz.net
Thu Jun 14 09:29:25 CDT 2007

Say you have a container of a fixed width with some text in it. Is there 
any way to count the number of lines in the text, as rendered?

<div id="wrapper" style="width: 300px;">
  Here is a bunch of text that may be short, may be very long, we don't
  know because it comes from user input.

Basically the design requires this fixed-size block for a list of 
preview items, but the request is to only show the first 4 lines, with 
an ellipsis and "more" link if needed. AFAIK this isn't possible, we 
can only count characters and words, right? which given the variation 
in font size and letter width is not reliable...


More information about the thelist mailing list