I have something like this:
<p id="container">
<span id="t1">This could be a very long text </span>
<span id="t2"> suffix 1</span>
<span id="t3"> suffix 2</span>
</p>
What I would like to do is, depending on the space available for the #container, adding ellipsis to the first of the spans so I would end up with something such as:
This is a very long text suffix 1 suffix 2 // If enough space available for everything.
This is a very long... suffix 1 suffix 2 // If there is not enough space available for everything.
This is a v... suffix 1 suffix 2 // If there is even less space available.
As you can see, the space for the suffix should be always preserved and only the first span text should be applied ellipsis.
Thank you very much for your help in advance! ;-)
is included may be variable but also the possible suffixes. I could use your technique combined with using getComputedStyle() but I was hoping for something 100% CSS-oriented. Please, have a look at this http://jsbin.com/aregeq/1/edit to see what I would be looking for. As I said, not only the div's width but also the suffixes' width may be variable... ;-) Thanks!
– Germán Toro del Valle Dec 11 '12 at 23:07