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

Re: [CSS21][css3-text] letter-spacing, word-spacing and justification

From: Alan Stearns <stearns@adobe.com>
Date: Wed, 16 Jan 2013 20:41:47 -0800
To: MURAKAMI Shinyu <murakami@antenna.co.jp>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <CD1CBEC1.19F17%stearns@adobe.com>
On 1/16/13 7:41 PM, "MURAKAMI Shinyu" <murakami@antenna.co.jp> wrote:

>I often see the following CSS code, I think this has a problem:
>
>p {
>  letter-spacing: 0pt;
>  word-spacing: 0pt;
>  text-align: justify;
>}
>
>In the CSS2.1 and CSS3 Text, the initial value of letter/word-spacing is
>'normal', stretchable in justification, and different from the fixed
>value 0pt. See the spec:
>
>CSS2.1
>http://www.w3.org/TR/CSS2/text.html#spacing-props
>    'letter-spacing'
>    ...
>    normal
>      ... This value allows the user agent to alter the space between
>characters in order to justify text.
>    <length>
>      ...  User agents may not further increase or decrease the
>inter-character space in order to justify text.
>
>CSS3 Text
>http://www.w3.org/TR/css3-text/#spacing-limits
>    <spacing-limits> = [ normal | <length> | <percentage>]{1,3}
>      ... If just one value is specified, then it represents the optimum,
>minimum, and maximum.
>http://www.w3.org/TR/css3-text/#text-justify
>    ... If the inline contents of a line cannot be stretched to the full
>width of the line box, then they must be aligned as specified by the
>Œtext-align-last¹ property. (If Œtext-align-last¹ is Œjustify¹, then they
>must be aligned as for Œcenter¹ if Œtext-justify¹ is Œdistribute¹ and as
>Œstart¹ otherwise.)
>
>
>My questions:
>- Is my understanding of the spec correct?--If the value of
>letter/word-spacing is '0pt', the <spacing-limits> is
>optimum=minimum=maximum=0pt and cannot be stretched in text justification.

I can't speak to CSS2, but in CSS3 Text you have this sentence:

---
The text justification process may alter the spacing from its optimum
(see the Œtext-justify¹ property, above) but must not violate the minimum
spacing limit and should also avoid exceeding the maximum.


---

So with optimum=minimum=maximum=0pt in justified text the 'added' spacing
must not go below 0pt, but it is allowed to go above 0pt when it's
impossible to justify the line without breaking the spacing constraints.

Thanks,

Alan
Received on Thursday, 17 January 2013 04:42:19 GMT

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