I have a span. I need both the below mentioned styles. But along with display: inline-flex, text-overflow: ellipsis is not working.
.ed-span{
   display: inline-flex!important;
   text-overflow: ellipsis;
 }
when I change inline-flex to inline-block it is working. But I need inline-flex.
How can i make it work?
Please help, Thanks.
text-overflow: ellipsis only works when the following is true: Parent element is not set to display: inline (span's default,) You must use display: block or display: inline-block. The element's width must be constrained in px (pixels) – it doesn't work with values specified using % (percent.)
To clip at the transition between characters you can specify text-overflow as an empty string, if that is supported in your target browsers: text-overflow: ''; . This keyword value will display an ellipsis ( '…' , U+2026 HORIZONTAL ELLIPSIS ) to represent clipped text.
I ran into the same issue. What you have to do is put the text within another div which has the overflow style. The inline-flex does not support text-overflow as seen here: https://bugzilla.mozilla.org/show_bug.cgi?id=912434
This should work:
<div class="parent-div">
    <div class="text-div">
    Ellipsis' are cool.
    </div>
</div>
Where the text-div style is as follows:
.text-div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
And parent-div:
.parent-div {
    display: inline-flex;
}
                        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