W3C home > Mailing lists > Public > www-style@w3.org > February 2010

Re: text-align:justify, inline-blocks, and MS test inline-formatting-context-019.xht

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 9 Feb 2010 08:25:25 -0600
Message-ID: <dd0fbad1002090625l32c23789m3bb27528fea5c0e2@mail.gmail.com>
To: Bruno Fassino <fassino@gmail.com>
Cc: www-style <www-style@w3.org>
On Tue, Feb 9, 2010 at 2:21 AM, Bruno Fassino <fassino@gmail.com> wrote:
> At 9.4.2 :
> "When the total width of the inline boxes on a line is less than the
> width of the line box containing them, their horizontal distribution
> within the line box is determined by the 'text-align' property.
> If that property has the value 'justify', the user agent may stretch
> spaces and words in inline boxes (except for inline-table and
> inline-block boxes) as well"
>
> What does the part  "(except for inline-table and inline-block boxes)"  mean?
> I don't think it means that  "inside"  inline-tables and inline-blocks
>  there is no stretching of spaces and words when text-align:justify.
>
> I think that the Microsoft test
> http://test.csswg.org/source/contributors/microsoft/submitted/Chapter_9/inline-formatting-context-019.xht
> adds more confusion. It has the following assertion:
>
> " If 'text-align' is set to 'justify' the user agent does not stretch
> spaces and/or words when the 'display' property is set to
> 'inline-block' "
>
> which again seems to imply that "inside" inline-block elements spaces
> and/or words are not stretched when 'text-align' is set to 'justify'.
> But then the test is not really precise. The reason why the second
> line is not stretched is simply that it is the _last_ (and the only
> one) inside the inline-block element. The first line is instead
> stretched because it is the first of two consecutive lines (the second
> one including just the inline-block box, acting like a single word).
> If some text is added inside the inline block to have two lines, then
> stretching will occur here as well, in all browsers, see for example
> this modified version
> http://www.brunildo.org/test/test/inline-formatting-context-019.html).
>
>
> Inline-block elements generate a single inline box (whose width is not
> affected by text-align), but then inside them text-align works as
> usual in all browsers, with possible stretching when it is 'justify'
> and there is more than a line.  So I can't figure out what the spec
> wanted to exclude when saying:  "(except for inline-table and
> inline-block boxes)"
> Maybe it simply wanted to say that the "external" single inline box
> generated by an inline-block element is not stretched by text-align,
> but the current words do not really say this.

Hrm.  It sounds like it's implying that in this code:

<inline text-align:justify;>foo foo foo <inline-block>bar bar
bar</inline-block> foo foo</inline>

The spaces around the foos are stretched, but it won't "reach into"
the inline-block and stretch the bars as well.  However, if the
inline-block had text-align:justify set on it, then it would of course
justify the text inside of it as normal.

~TJ
Received on Tuesday, 9 February 2010 14:26:19 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:24 GMT