<p>I have a table column that needs to be limited to a certain width - say 100 pixels.  At times the text in that column is wider than this and contains no spaces. For example:</p>

<pre><code>a_really_long_string_of_text_like_this_with_no_line_breaks_makes_the_table_unhappy
</code></pre>

<p>I would like to calculate the width of text server-side and add an ellipsis after the correct number of characters.  The problem is that I don't have data about the rendered size of the text.</p>

<p>For example, assuming the browser was Firefox 3 and the font was 12px Arial.  What would be the width of the letter "a", the width of the letter "b", etc.?</p>

<p>Do you have data showing the pixel width of each character?  Or a program to generate it?</p>

<p>I think a clever one-time javascript script could do the trick.  But I don't want to spend time re-inventing the wheel if someone else has already done this.  I am surely not the first person to come up against this problem.</p>

Very very hard to do server-side. You can never know what fonts users have installed, and there are many things that affect the display of text.
Try this instead:
```
```
table-layout: fixed;
```
```
That'll make sure the table is never larger than the size you specified.