W3C home > Mailing lists > Public > www-style@w3.org > January 2013

Re: A proposed standard for CSS-controlled sentence spacing

From: Thomas A. Fine <fine@head.cfa.harvard.edu>
Date: Fri, 11 Jan 2013 14:26:14 -0500
Message-ID: <50F06756.2080009@head.cfa.harvard.edu>
To: Markus Ernst <derernst@gmx.ch>
CC: "Tab Atkins Jr." <jackalmage@gmail.com>, www-style mailing list <www-style@w3.org>
On 1/11/13 7:48 AM, Markus Ernst wrote:
> <span class="sentence">I am a sentence.</span>
>
> .sentence { margin-right: 0.5em; }
 >
> This has the downside that it won't justify when the end of the sentence
> happens to be at the right margin. I am not perfectly familiar with all
> aspects of CSS3, so forgive me if I am wrong, but I don't see how
> Thomas' task could be handled with existing markup.

Yes this is inadequate for the reasons you say.  You can use 
word-spacing, set it to the desired sentence-spacing in the surrounding 
element, and back to word-spacing within each sentence, but that's a big 
mess.

The :after selector can be used to do it in one step, and in if you use 
it to insert an extra space after the sentence and then format that 
space.  I haven't tested this in all browsers, but it does seem to be 
the simplest choice at the moment.  It worked in Safari, BUT I could 
easily see this going awry in how it interacts with the existing space 
if the processing order is not consistent across implementations.  You 
could also leave out the intervening space and let the :after selector 
add it, but this would mean your original content would be "wrong" and 
cut and paste (for example) might not be correct.

> Maybe it would be a good idea to propose a new property that behaves
> like margin between adjacent inline elements, but does not affect the
> distance from the container boundaries?
>
> .sentence { inline-margin-right: 0.5em; }

I've considered the idea of a generic "spacing" element that could be 
applied to any inline element.  But it raises the question of how 
adjacent "spacing" values are handled.  Adding them would usually be 
wrong.  You could average or do a higher one wins or something.  At that 
point you'd also need CSS to describe how they should interact and maybe 
a priority to have one override another.

Such a system might be very powerful, but is probably too complicated 
both in implementation and in usage to be practical.

Right now my thinking is the best first step is to provide CSS that 
recognizes two spaces after terminal punctuation as a sentence as it's 
the simplest for content creators, as it perfectly matches an existing 
content creation practice.

       tom


    tom
Received on Friday, 11 January 2013 19:26:48 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:04 GMT