Truncating text inside a div
Apart from ellipsis
, I would suggest display the whole text on mouse hover using tooltip
.
fiddle
You should look at css ellipsis : http://www.w3schools.com/cssref/css3_pr_text-overflow.asp
Use these styles:
white-space: nowrap; /*keep text on one line */
overflow: hidden; /*prevent text from being shown outside the border */
text-overflow: ellipsis; /*cut off text with an ellipsis*/
I would suggest Trunk8
You can then make any text fit to the size of the div, it trims the text that would cause it to go beyond 1 line (options are available to set amount of lines allowed)
E.g
$('.truncate').trunk8();