Re: box-align

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.

~TJ

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