|
Posted by Andy Hassall on 07/30/05 15:48
On Sat, 30 Jul 2005 13:15:56 +0200, "Bas Varkevisser"
<b.varkevisser_at_hccnet.nl> wrote:
>I need to calculate the length of a string in pixels to see if a text
>exactly fits in a fixed-width table.
What sort of table? HTML table? In which case, no, you can't, not exactly or
reliably anyway, since browsers don't have to use the fixed font size you
specify in CSS, and for non-fixed-width fonts you can't always tell what actual
font the end user's browser will use, so you don't know the character widths.
It might be possible with some fairly dodgy Javascript.
Is there maybe something you could do with the "overflow" CSS property to get
the text clipped if it goes past the end of the cell?
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Navigation:
[Reply to this message]
|