W3C home > Mailing lists > Public > www-style@w3.org > December 2012

Re: CSS needs improvements for handling sentence spacing

From: Gérard Talbot <www-style@gtalbot.org>
Date: Thu, 20 Dec 2012 16:44:25 -0500
Message-ID: <e85569a57531961edd59ef1699b2dacb.squirrel@ed-sh-cp3.entirelydigital.com>
To: "Thomas A. Fine" <fine@head.cfa.harvard.edu>
Cc: "www-style mailing list" <www-style@w3.org>

Le Jeu 20 décembre 2012 15:07, Thomas A. Fine a écrit :
> Suppose I have an interest in formatting additional space between
> sentences.  I might want to do this because:
>    * I want to approximate the historic norm for published works from
> roughly 1650 to 1950
>    * There is some evidence to support that such spacing is helpful for
> new readers, people with certain learning disabilities, and more
> generally people who are speed-reading or scanning.
>    * Or just because I find it aesthetically pleasing
> The most popularly recommended solution is a non-CSS solution, to use
> the &nbsp entity to add an extra non-collapsing space.  The non-breaking
> space messes up justification where it occurs at line wraps.  Even if
> this is changed to some other space entity, or just a regular space
> together with setting white-space to pre-wrap, this is still not a CSS
> solution, and allows for no fine-grained control.
> Unfortunately CSS lacks a reasonable approach for accomplishing this
> seemingly simple feat.  Using the box model on sentence spans does not
> work properly, because space added in the box model is not wrappable
> white space, and as such it messes up justification.

You are pinpointing precisely why experts in legibility do *not* recommend
justified text. Left-aligned text is recommended and has been around for
over one hundred thousands years (100,000), even in
Cromagnon/Neanderthalian caves, on pyramid walls, etc.

Speed reading and text skimmability/eye scannability is most efficient
with left-aligned text and *not* with justified text.

(...) justified text blocks often suffer from poor spacing and excessive
hyphenation and require manual refinement.
This level of control is not even a remote possibility on web pages.
Modern browsers support justified text, but it is achieved by crude
adjustments to word spacing.
For the foreseeable future, the legibility of your web documents will
suffer if you set your text justified.
Left-justified text is the most legible option for web pages(...)

Web Style Guide 3rd edition, chapter 8 Typography: Legibility


> One method does work, but in my opinion is not acceptable.  You can set
> word-spacing to a wide value for your divs or paragraphs, and then reset
> it back to a normal value for every sentence or other contained element.
>   This approach to me seems inverted.  You are effectively setting
> word-spacing to an incorrect value overall and then correcting it
> farther down.  This is confusing and error-prone.
> Possible CSS solutions:
> #1. If a sentence tag existed, then a "sentence-spacing" parameter could
> be used to adjust sentence spacing wherever two sentences touch.  In the
> absence of such a tag, it could still be possible for a user to specify
> another CSS parameter that describes which spans should be considered
> sentences, e.g. "sentence-span: .sntc" would consider anything of that
> class to be a sentence.
> #2. A generic inline spacing parameter could be created for all inline
> elements.  This would be more powerful because you could then customize
> spacing around any phrase or inline image or anything else, but also
> more complicated, as there would have to be some method for two
> connecting elements to negotiate the space between them (e.g. averaging,
> larger one wins, or that it only applies to leading or following space,
> etc.)
> #3. If an unambiguous full-stop entity (&fullstop) or unicode character
> existed, this could reliably be used to format sentences.  Alternatively
> this could also be an unambiguous inter-sentence space (&sentencespace).
> #4  You could also put a tag only around the white space between
> sentences, and use CSS to control that word-spacing.  This does solve
> the problem of inverting your model that my current word-spacing
> solution would have, but I'm not sure that having a piece of content
> consisting solely of white space makes any sense.
> #5. This could be handled through automatic sentence detection.
> Unfortunately these algorithms are not reliable because periods are
> ambiguous, and more generally control is not in the hands of the content
> creator.  On the other hand, it would instantly give sentence spacing
> ability to every existing HTML document with only a single change.
> Also, "period-newline" or "period-space-space" could be used as methods
> of detecting sentences more reliably within the HTML source.
> This approach could also be a fallback option within solution #1 above
> (e.g. "sentence-span: auto").  Or alternatively, with automatic sentence
> detection there could be a method of tagging only those things the
> algorithm might get wrong, e.g.  "<NotAFullStop>. </NotAFullStop>"
> For the record I prefer a sentence tag or span around actual sentences
> as this has the side-effect of providing semantic information on where
> each sentence starts and ends, and no other solution provides that.
>       tom

CSS 2.1 Test suite RC6, March 23rd 2011

Contributions to CSS 2.1 test suite

Web authors' contributions to CSS 2.1 test suite
Received on Thursday, 20 December 2012 21:44:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:24 UTC