Forum How do I...?

Justifying lines of text that don't have spaces

Recently, we've come across lots of novels where authors string together dozens or hundreds of words using only hyphens, with no spaces (see attached screenshot). We have not found a good way to justify these lines. We can set text-align-last to justify, and then every line in the paragraph is justified, but in general we don't want to force-justify the last line.

We can put spans around individual lines, and then hand-adjust the letter-spacing until the line looks justified, but that's horribly labour-intensive.

It's as if we want text-justify: distribute; for lines that don't have spaces. Are there any properties in CSS3 text that would do this? If not, should there be?


Dave Cramer

  1. justify.png30.1 kB

Edited by dauwhe

Perhaps that is not the correct screenshot...?
I'm an idiot. Fixed now.

In my defense, I'm quite jet-lagged after returning from a W3C workshop :)


So in this case where the line contains no spaces at all, would you prefer the remaining space to be distributed evenly between each character?
That makes sense... the spacing between characters is the only thing that can be altered without changing the characters themselves.
Right, we'll add this to the roadmap for future development.
This is quite similar to the problem of justifying text in book notes sections, where there are often multi-line URLs, again with no break opportunities.

As to the obvious questions of why justify this kind of text, and why people would try to type a multi-line URL they found in a printed book, I don't have answers :)