Re: [css3-text] letter-spacing at element boundaries

On 01/30/2012 02:01 PM, Jonathan Kew wrote:
> The current WD says,[1]
>
>    "At element boundaries, the total letter spacing between two characters is given by and rendered within the innermost element that<em>contains</em>  the boundary."
>
> AIUI, this means that in the example
>
>    <p>The quick<span style="letter-spacing:1em">brown</span>  fox</p>
>
> we should have no extra spacing (beyond the standard word-space) before or after the word "brown", because the boundaries<space, letter b>  and<letter n, space>  are not _contained_ by the span that has the letter-spacing, but only by the<p>  element. So the expected rendering is something like this:
>
>    The quick b    r    o    w    n fox
>
> (Correct?) However, I think from an author's point of view, it would be more natural to have a somewhat different rule, such that in this example, the word spaces before and after "brown" _would_ be affected:
>
>    "At element boundaries, the total letter spacing between two characters is the mean of the letter-spacing property of the characters on each side of the boundary."
>
> This would add 0.5em to the word spaces each side of "brown" in the above example:
>
>    The quick   b    r    o    w    n   fox
>
> My thinking is [...]
> I also noticed that fantasai seemed to think[2] back in 2005 that this would be the appropriate behaviour. However, a later comment[3] chose a different behaviour. I'm interested to know whether that was a decision driven by specific needs/use-cases, or would it be worth reconsidering?

My thinking was that if I had

em<em>phatic</em>ally

and I specified some letter-spacing, would I really expect to get

em p  h  a  t  i  c ally

? It seemed to me it made more sense for only the characters inside the
<em> to be spaced apart from each other, and certainly not to have a
half-space between some letter pairs and a full space between others.

I think your example seems more reasonable with the half-spacing treatment
because
   a) your letter-spacing boundary coincides with a word space
   b) your letter-spacing amount is a larger amount than the word
      spacing

I suspect if both of these were not true, you would not come to the same
conclusion as you did. Note that the behavior in the spec gives the most
control: if you want, you can add margins or padding to the element and
control precisely the extra spacing on the outer boundary; and the amount
of spacing between two elements, each with their own letter-spacing values,
is predictable.

And that was my thinking.

What are your thoughts now?

~fantasai

Received on Wednesday, 1 February 2012 10:01:33 UTC