I am trying to give ellipsis to a span
element which is inside td
element. The problem is that the ellipsis is working if and only if I give the span
element a fixed width i.e width in pixels. But in my project, I can't use a fixed width to the span
element. The span
element must be completely stretched inside the respective td
element which is possible by using width: 100%
.
My question is: How to make the ellipsis work fine by stretching the span
element completely inside the td
element?
span {
width: 100%; /* In pixels, it is working fine */
display: block;
white-space: nowrap;
text-overflow: ellipsis;
overflow:hidden;
}
Here is the Fiddle
I am looking for a solution which can be a pure css or javascript or jQuery. The solution should work in IE8+ and firefox.
PS: I can't calculate the width of the span dynamically due to some project restrictions.
EDIT: I can't restrict the widths of the td elements, because I am implementing column resizable on td elements.