I have a table with 3 dots '...' at the end of each line when necessary (text overflow). I used the ellipsis value of the text-overflow property. It works: when the window is resized, the '...' are showed but I have 2 problems when the line in my table contains a span:
See demo here: http://jsfiddle.net/Ah4DR/1/
Maybe this is a novice question but I searched for a time and not found any solution.
I forgot to say that this don't works on Internet Explorer but works fine on Chrome.
Thanks!
If the ellipsis is taking the color of the div, then make the div the color you want the ellipsis to be, and use . color to set the initial text black.
So, if you've arrived at this question because you're having difficulties getting the ellipsis to operate inside a display: Try adding min-width: 0 to the outmost container that's overflowing its parent, even if you've previously set overflow: hidden to it, and see how it works for you.
ellipsis. This keyword value will display an ellipsis ( '…' , U+2026 HORIZONTAL ELLIPSIS ) to represent clipped text. The ellipsis is displayed inside the content area, decreasing the amount of text displayed. If there is not enough space to display the ellipsis, it is clipped.
A text-overflow property in CSS is used to specify that some text has overflown and hidden from view. The white-space property must be set to nowrap and the overflow property must be set to hidden. The overflowing content can be clipped, display an ellipsis ('…'), or display a custom string.
I had the same problem; while my text was white on dark-grey, the ellipsis color seemed to be black. I solved it by simply setting the color of the that contained the text-overflow: ellipsis, like this:
.ellipsis-div {
white-space: nowrap;
width: 154px;
overflow: hidden;
text-overflow: ellipsis;
color: white; /* --> ellipsis color */
}
It certainly seems to be a bug in IE. It is (for whatever reason) reading the color of first element (or maybe it is the first content) to determine the color of the ellipsis. However, I did find a "work around" for the bug. I would recommend if possible setting this up in some way to just target IE (and only the td
elements you are using text-overflow
on), but as a proof of concept, this fixes it:
td:before {content: ''; color: black;}
Apparently the first td
content that is defining the color need not be real content, because the pseudo content worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With