Last Comment Bug 741743 - Allow to truncate string in the middle via text-overflow
: Allow to truncate string in the middle via text-overflow
Status: RESOLVED DUPLICATE of bug 740910
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: All All
-- enhancement (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Jet Villegas (:jet)
Depends on:
  Show dependency treegraph
Reported: 2012-04-03 05:00 PDT by Sebastian Zartner
Modified: 2012-04-03 10:24 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Sebastian Zartner 2012-04-03 05:00:17 PDT
According to and there's currently only the possibility to clip strings at the beginning and their end.
Though for recognizability it's sometimes better to crop the string in the middle.
Firebug is using that principle for file names and URLs and it works well. Though the strings are not cropped dynamically. So there's a problem when the containing element is resized. See


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

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:

Thereby the most characterizing part is obviously the file extension.
So to keep this 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:

I imagine the CSS syntax to be specified like this:
p {
  white-space: nowrap;  
  width: 100%;                     
  overflow: hidden;
  text-overflow: clip ellipsis clip 3;

p {
  white-space: nowrap;  
  width: 100%;                     
  overflow: hidden;
  text-overflow-left: clip;
  text-overflow-middle: ellipsis
  text-overflow-right: clip
  text-overflow-left-preserve: 0;
  text-overflow-right-preserve: 3;

Comment 1 User image Boris Zbarsky [:bz] (still a bit busy) 2012-04-03 10:24:36 PDT

*** This bug has been marked as a duplicate of bug 740910 ***

Note You need to log in before you can comment on or make changes to this bug.