This guy: https://stackoverflow.com/a/7239020/2453678 posted a great answer here: http://jsfiddle.net/imoda/REs2Q/
Basically, if you want a elegant solution, counting the number of characters is out of question, as each letter has different weight.
The question is:
span {
display: inline-block;
border: black 1px solid;
width: 200px;
height: 40px;
overflow: hidden;
}
How to modify the above code, so at the end, if the string is shortened, three '.' are added?