W3C home > Mailing lists > Public > www-style@w3.org > April 2011

Re: box-align

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 29 Apr 2011 23:41:54 -0700
Message-ID: <BANLkTim5wBszr=FLt2qczgWQi5pVF7POyQ@mail.gmail.com>
To: Andrew Fedoniouk <news@terrainformatica.com>
Cc: Alex Mogilevsky <alexmog@microsoft.com>, Brad Kemper <brad.kemper@gmail.com>, www-style list <www-style@w3.org>
On Fri, Apr 29, 2011 at 10:55 PM, Andrew Fedoniouk
<andrew.fedoniouk@live.com> wrote:
> So either we will invent bunch of alignments like box-align, grid-align,
> cell-align, etc. or we will try to unify all this in vertical-align
> (and horizontal-align).

We should indeed try and unify these concepts.  'vertical-align' is
not the place to do so.

>> This is fairly simple.  The inline-layout model asks the inline-block
>> for its baseline.  The baseline of an inline-block is defined as the
>> baseline of its last in-flow linebox.  So then you need to lay out the
>> inline-block.  Do so, respecting the alignment, and return the
>> position of the last linebox.  Then, align the inline-block within its
>> line accordingly.
> I am not getting the idea of "last in-flow linebox". Why not the first
> for example?

Because that's the way it's defined in CSS 2.1.  Apparently someone
thought it was reasonable.  I think it probably is as well.

> Say you have <select size=1> which is under the hood is
> <dropdown-select>
>  <caption>text</caption><button />
> </dropdown-select>
> The caption is what really makes sense to align here with the baseline
> of contained text. If you will try to use button for that (last in flow) you
> will get wrong results.
> In other words: in context of inline flex blocks vertical-align:baseline
> makes sense when it defines baseline alignment of element inself *and* its
> children. Otherwise you will have that artificial first/last problem.

Form elements are magical, and their contents are unknown and
unknowable to CSS until the UI Module defines them.  Don't try and
draw any conclusions from them.

> Say you have this:
> <p>... text <i-block>A</i-block> <i-block>B</i-block></p>
> i-block
> {
>  box-align: bottom;
>  vertical-align: baseline;
> }
> How exactly you will compute ascent of the i-block?
> See: you can compute box-align:bottom only after you
> will have height of line box. But to compute line box height
> itself you need to know ascent (baseline position) of the
> i-block. Chicken-Egg problem in its magnificence.

This entire paragraph is wrong.  The inline-block *contains* a
linebox, yes, which contains "A".  The linebox itself is aligned to
the bottom of the inline-block.  The resulting position of the
linebox's baseline is used as the position of the inline-block's
baseline.  The inline-block is then baseline-aligned with the other
content on the line.  At no point is there anything circular.

Received on Saturday, 30 April 2011 06:42:41 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:45 UTC