I have a table, and in each cell I want to place strings, but they are much wider than the cell width. To prevent line break, I would like to shorten the strings to fit the cell, and append '...' at end to indicate that the string is much longer.
The table has about 40 rows and has to be done to each cell, so its important that its a quick. Should I use JS/jQuery for this?
How would I do it?
Thank you for your time.
Kind regards,
Marius
You can use CSS -- text-overflow: ellipsis -- for this - with some caveats for certain browsers and workarounds listed here:
http://mattsnider.com/css/css-string-truncation-with-ellipsis/ (archived)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With