Ideal method to truncate a string with ellipsis

I like the idea of letting “thin” characters count as half a character. Simple and a good approximation. The main issue with most ellipsizings however, are (imho) that they chop of words in the middle. Here is a solution taking word-boundaries into account (but does not dive into pixel-math and the Swing-API). private final static … Read more

text-overflow:ellipsis in Firefox 4? (and FF5)

Spudley, you could achieve the same thing by writing a small JavaScript using jQuery: var limit = 50; var ellipsis = “…”; if( $(‘#limitedWidthTextBox’).val().length > limit) { // -4 to include the ellipsis size and also since it is an index var trimmedText = $(‘#limitedWidthTextBox’).val().substring(0, limit – 4); trimmedText += ellipsis; $(‘#limitedWidthTextBox’).val(trimmedText); } I understand … Read more

Insert ellipsis (…) into HTML tag if content too wide

The following CSS only solution for truncating text on a single line works with all browers listed at http://www.caniuse.com as of writing with the exception of Firefox 6.0. Note that JavaScript is totally unnecessary unless you need to support wrapping multiline text or earlier versions of Firefox. .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)