Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need an overflow to truncate from the left, with ellipses

Tags:

Briefly, I have a field where the rightmost digits are most significant. (Naturally, this field comes from our affiliates' systems, based on their primary keys, so the left most digits only change once per epoch!)

Everyone knows CSS provides a RIGHT truncation with "text-overflow: ellipsis;". How (without adding code to the server to prepare that field via string-surgery) do we truncate the field on the LEFT, and put the "..." elipses on the LEFT?

(CSS3 is okay.)

like image 265
Phlip Avatar asked Oct 06 '12 16:10

Phlip


People also ask

How do you overflow 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.

How do you text-overflow ellipsis in a table?

The overflowing content can be clipped, display an ellipsis ('…'), or display a custom string. Syntax: text-overflow: clip|string|ellipsis|initial|inherit; Example: In the following example,we will consider ellipsis to use the test-overflow property in a table cell.

What does text-overflow ellipsis mean?

Definition and Usage The text-overflow property specifies how overflowed content that is not displayed should be signaled to the user. It can be clipped, display an ellipsis (...), or display a custom string.

Why is text-overflow ellipsis not working?

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.)


1 Answers

Try to use this trick:

HTML

<p class="ellipsis">ert3452654546</p> 

CSS

.ellipsis {     overflow: hidden;     width: 60px;     direction: rtl;      margin-left: 15px;     white-space: nowrap; }  .ellipsis:after {     position: absolute;     left: 0px;     content: "..."; }​ 

FIDDLE

like image 57
khomyakoshka Avatar answered Sep 28 '22 06:09

khomyakoshka