how to truncate text with respect to div height?

html, javascript, jquery

Solution

Try the following CSS:

text-overflow: ellipsis;
overflow: hidden;
whitespace: no-wrap;

This only works for single lines. For multiple lines you need JavaScript.

Problem

I have a div with height of 192px. I want to truncate text within div and want to show `...` in the end. now due to large text, button is clipping as shown in the snapshot. This happens when I add html tags in it. Can anyone help?

Original source

Related problems