Re: [css21][css3-text] inline horizontal alignment and the effect of 'text-align' either ambiguous or underspecified

On 11/13/2012 02:26 AM, Kang-Hao (Kenny) Lu wrote:
> I was again surprised by CSS 2.1 with a test case like
>    data:text/html,<style> div { width: 5em; border: red solid;
> text-align: right; margin: auto; } span { border: blue solid;
> padding-left:50px; }</style><div><span>jfoiasdjodfasdf</span></div>
> . That is, when an unbreakable inline box has a width bigger then the
> linebox, 'text-align' has no effect and is treated as 'left'. But I
> don't think this is clear from the spec.
> The closest thing I can find is this paragraph in 9.4.2
>    # When the total width of the inline-level 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 (but not inline-table
>    # and inline-block boxes) as well.
> , which does imply that 'text-align' has no effect when the total width
> is bigger than the width of the line box, but what's the default
> behavior? This paragraph in the same section
>    # In an inline formatting context, boxes are laid out horizontally,
>    # one after the other, beginning at the top of a containing block.
>    # Horizontal margins, borders, and padding are respected between
>    # these boxes. The boxes may be aligned vertically in different ways:
>    # their bottoms or tops may be aligned, or the baselines of text
>    # within them may be aligned. The rectangular area that contains the
>    # boxes that form a line is called a line box.
> seems quite ambiguous. In particular, it doesn't say
>    1. It's the start side where the boxes are started being laid out. In
>       fact, this section doesn't mention 'direction' at all and I don't
>       think "9.10 Text direction: the 'direction' and 'unicode-bidi'
>       properties" mentions inline box layout either.

   "If (after justification, if any) the inline contents of a line box
    are too long to fit within it, then the contents are start-aligned:
    any content that doesn't fit overflows the line box's end edge."

Let me know if that's accurate.

>    2. By default there should be no spacing between the inline boxes.

Given we also don't say anything about no extra spacing between block boxes,
I think I might punt on this one... or maybe I'll work it into the as-yet
unwritten intro somehow, not sure yet.


Received on Saturday, 11 May 2013 02:53:49 UTC