JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/ui-lightness/jquery-ui.css">
<div id='container'>
<span id='text'>Lorem Ipsum is simply
dummy text of the printing
and typesetting industry.
</span>
</div>
CSS
#container {
width: 150px;
height: 50px;
line-height: 25px;
position: relative;
}
JavaScript
var $container = $('#container');
var $text = $('#text');
var originalText = $text.text();
var temp = originalText;
if( $container.outerHeight() < $text.outerHeight() ) {
while($container.outerHeight() < $text.outerHeight()) {
$text.text( temp = temp.substr(0, temp.length-1) );
}
$text.text( temp = temp.substr(0, temp.length-3) );
$text.append('...');
}