Just wondering if this is possible in purely just CSS. I want to truncate some text for a file uploader so that it doesn't overflow. The text that displays the file name is styled with the following CSS:
span {
margin-left: 20px;
overflow: hidden;
max-width: 50ch;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
font-style: italic;
background: var(--color-light-gray);
padding: 3px 20px;
border-radius: 8px;
}
With this code, if you upload a file called something like:
Long_file_name_blah_blah_blah.pdf
It will truncate to something like:
Long_file_name_bl...
This is fine, however since it's a file uploader I'd prefer it if the file extension was visible after truncation, so I'm thinking I want to truncate it from the beginning of the file name, that way the same file above would look like:
...lah_blah_blah.pdf
However I can't find a way to do it in pure CSS. I could do this in javascript but I was wondering if there was a way to do it just with HTML and CSS?
Thanks!