1

I am trying to show the one line sentence followed by three dots (...) if the range goes beyond the line size.

I have used the below CSS which works fine on Mozilla and Chrome but does not work on IE 11.

display: block;
overflow: hidden;
text-overflow: ellipsis;
padding-right: 20px;

Please let me know if this is due to any version issue on IE11 for this ellipsis or if there is a fix for it.

4
  • Can you show us your HTML code too? Commented Mar 9, 2018 at 10:03
  • Give us more details, a demo will be perfect. IE 11 supports text-overflow. Commented Mar 9, 2018 at 10:05
  • @Ronald : Below is the HTML code. <div class="qd-result-card__name-and-doctor" flex=""> <span class="qd-result-card__name qd-result- card_tests_ordered" ng-bind- html="vm.renderTestOrderNames(searchResultObj.testOrderName)"></span> </div> qd-result-card__name - this is the css which holds the above style for this particular div
    – Bhanu
    Commented Mar 9, 2018 at 10:57
  • @Carnaru - Demo means do you want the screen shot of this not working on IE browser?
    – Bhanu
    Commented Mar 9, 2018 at 11:02

4 Answers 4

1

IE11 support white-space:nowrap; & text-overflow:ellipsis;

Try like this

h2 {
    display: block;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis; 
    padding-right: 20px;    
}
1
  • display: block; did the job for me!
    – jkonst
    Commented Sep 11, 2019 at 10:30
0

For IE ellipsis will only work on input fields if the readonly attribute is set to readonly or true.

$('.all-javascript input').on('focusout',
function() {
  $(this).prop('readonly', 'readonly')
})

$('.all-javascript input').on('focusin',
function() {
  $(this).prop('readonly', false)
})
div {
  margin: 40px 20px;
}

input {
  width: 300px;
  display: inline-block;
  white-space: nowrap 
  overflow:hidden;
  text-overflow:ellipsis; 
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<div class="chrome">
  <input type="text" value="Lorem ipsum dolor sit amet, liberavisse signiferumque ex pri, diam brute epicurei cum ad. Ne mutat nostrud erroribus eam. At vis ignota appareat, vis tollit dicant cu. Est ceteros consequuntur an, an diceret iracundia maiestatis sea, an modo perfecto ocurreret mea. An mel quot philosophia. Elit dicant expetenda qui te.">
</div>


<div class="ie-11">
  <input type="text" value="Lorem ipsum dolor sit amet, liberavisse signiferumque ex pri, diam brute epicurei cum ad. Ne mutat nostrud erroribus eam. At vis ignota appareat, vis tollit dicant cu. Est ceteros consequuntur an, an diceret iracundia maiestatis sea, an modo perfecto ocurreret mea. An mel quot philosophia. Elit dicant expetenda qui te." readonly='readonly'>
</div>

<div class="all-javascript">
<input type="text" value="Lorem ipsum dolor sit amet, liberavisse signiferumque ex pri, diam brute epicurei cum ad. Ne mutat nostrud erroribus eam. At vis ignota appareat, vis tollit dicant cu. Est ceteros consequuntur an, an diceret iracundia maiestatis sea, an modo perfecto ocurreret mea. An mel quot philosophia. Elit dicant expetenda qui te.">
</div>

0

Try this code it will work in IE 11

overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
2
  • If i remove display: block then it gets overlapped with the other div which is adjacent to this sentence
    – Bhanu
    Commented Mar 9, 2018 at 12:07
  • Can you give me your code i have to see the code for that Commented Mar 9, 2018 at 12:09
0

IE11 weirdness

One interesting fact about IE and overflow:ellipsis – if your text contains line breaks, it will only work for the first line. Here's an example:

<style>
    div {
        width:100px;
        text-overflow:ellipsis;
        overflow:hidden;
        white-space:nowrap;
        padding-bottom:10px;
    }
</style>
<div style="color:green">
    Something longer than a line
</div>
<div style="color:red">
    Something longer than a line<br>
    And here's another, just<br>
    to demonstrate this weirdness
</div>

Here's what it looks like – IE11 on the left, well educated browsers on the right:

Multiline overflow rendered in IE11 – vs – Multiline overflow rendered in any other browser

Not the answer you're looking for? Browse other questions tagged or ask your own question.