title: Replace too long strings with "..."
body: <p>Lets say we have a <code>&lt;div style="width:100px;"&gt;This text is too long to fit&lt;/div&gt;</code></p>
  
  <p>The text in the div is dynamic. And I'd like to force the text to fit in width and not break.
  So i need some kind of functionality to test if the text is going to fit, and if it is not, then i'd like to display the portion of the text that will actually fit. And append <code>...</code>to the end.</p>
  
  <p>Result for a too long text should be something like this: <code>"This text is..."</code></p>
  
  <p>Is there some standard way of doing what i want? Either by javascript, jquery, jsp or java?</p>
  
  <p>Thanks!</p>
  
  <p>Edit:
  Thanks for your quick and many answers! I was doing this in java by guessing how many characters would fit. It seemed like a less than optimal solution, so thats why i came here.</p>
  
  <p>The css solution is perfect for me. Its not that big of a deal that it doesnt work for firefox, since my clients all use ie anyway. :)</p>