I doubt this is possible, but wanted to ask just in case... Also, I did find this Q/A, but it's not the right solution for my situation (or I'm doing it wrong)...
I have a column of single lines of text (e.g. each div
inside the column is white-space: no-wrap
), and this column is 50% of the page's width... I can easily add overflow: hidden
and text-decoration: ellipsis
to get each line of text to truncate on the right-hand side, but I've been asked to make it truncate on the left (to cut-off the start of each line)...
The problem with solutions like using direction: rtl
is that it causes all the lines that don't truncate to be right-aligned, and I need those to still be left-aligned... Is that possible?
Edit, to add example code:
{
width: 400px;
border: 1px solid grey;
}
#column>div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
<div id="column">
<div>I'm a very long string of text and I should be truncted on my left-hand side (at the start) and not here at the right-hand side</div>
<div>I'm a shorter string -- I should be left aligned</div>
</div>
If you add direction: rtl
to #column
, the first line is correctly truncated at the start, but the second line is incorrectly right-aligned...