Quick disclaimer: I saw some plugins that truncate text strings but they do not do it the way I need it...
I need to truncate the text by limiting the space allocated to it. For example, if i have a block of text and it is placed in a div that has dimensions preventing entire text to be shown, I' like to show as much as possible and then append helix at the end of the string.
I think I can use overflow:hidden, but how do I add "..."? Also, is it possible to determine if the text needs more space than the area provide?
<div style="width: 300px; height: 100px; border: 1px solid #ccc; overflow:hidden">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis facilisis risus vel mi placerat ut bibendum dui tempus. In dictum quam eu sem condimentum elementum. Cras id urna eget turpis feugiat porttitor. In hac habitasse platea dictumst. Cras tincidunt risus id sapien sagittis feugiat interdum orci adipiscing. Sed venenatis neque nec nibh mattis laoreet. In ut sapien in felis posuere feugiat. Nulla vulputate, augue nec elementum volutpat, justo nisl vulputate tellus, eget blandit lectus enim at ante. Donec posuere augue a orci sollicitudin ut imperdiet ante varius.
</div>