Existing behavior

Proposal

For recognizability it's sometimes better to crop the string in the middle. To keep the recognizability high even on small strings, there should be a way to define parts of the content, which should be preserved, i.e. not be truncated.

To do so the text-overflow property could be extended to allow defining a third value for the middle-string replacement and values defining the lengths of the string parts to preserve. So its syntax would look something like this:

With the current implementation this could be cropped to something like this:

this_is_a_very_lo…
this_is_a_very_lo…

So the file types and names can't be destinguished.

If the truncation could be specified to happen in the middle of the word, this would look like:

this_is_a_…ename.txt
this_is_a_…name2.jpg

Regarding this use case the most characterizing part is obviously the file extension.
So to keep it visible there could be another option to specify the number of characters to prevent from being cropped (at the left and the right side).

So if there's just space for e.g. 5 characters and we specified not to crop the right 3 characters, the result would look like this:

t…txt
t…jpg

Because there will be some more values available for the text-overflow property, it would make sense to convert it to a shorthand property consisting of the following longhand properties:

text-overflow-start, text-overflow-middle and text-overflow-end would define the replacement string at the beginning, the middle and the end of the text. And text-overflow-min-width would hold one or two values representing the minimum width of the right and the left part of the content to preserve.