Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are my overflow ellipses being cut off in Chrome?

enter image description here

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;
}
like image 846
adamdport Avatar asked Jun 06 '16 20:06

adamdport


People also ask

Why text-overflow ellipsis is not working?

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.

How do you adjust the overflow on an ellipsis?

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.


1 Answers

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.

like image 123
adamdport Avatar answered Sep 29 '22 07:09

adamdport