At certain widths, my ellipses are being cut off. I've created a fiddle that demonstrates it. I've tried different combinations of margin and padding, but cannot seem to eliminate it. I'm using Chrome 51.
Note: I've simplified my example for brevity. My actual div is responsive, and the text is dynamic. I need a solution that will work for any text at any width.
Is there any way I can get around this issue?
<div class="container">
<div class="nowrap">This text should be truncated</div>
</div>
<div class="container two">
<div class="nowrap">This text should be truncated</div>
</div>
.container{
width:196px;
font-size:30px;
}
.container.two{
width:193px;
}
.nowrap{
text-overflow: ellipsis;
white-space:nowrap;
overflow:hidden;
}
text-overflow: ellipsis only works when the following is true: The element's width must be constrained in px (pixels) – it doesn't work with values specified using % (percent.) The element must have following properties set: overflow: hidden and white-space: nowrap.
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.
The issue that I created on Chromium got merged as a duplicate of this issue, which then got merged as a duplicate of this issue. I will update this answer as the status changes.
UPDATE: The issue does NOT appear in Canary, so a near-future release of Chrome should resolve the issue.
UPDATE 2: The issue has been resolved in Chrome 52.
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