Re: [css3-flexbox] alignment test

On Fri, Dec 2, 2011 at 4:33 PM, Alex Mogilevsky <alexmog@microsoft.com> wrote:
> Actually Tab wanted margin alignment to work, right Tab? It is not in the
> spec currently but so far I am sure it is our intent is to provide exactly
> same behavior as in old spec (that’s why I link to the old spec), just word
> it in a more readable way.
>
> You are right, margin alignment duplicates per-item alignment. Actually
> considering that, I think we should consider making alignment apply to
> flexbox as in old spec. It is often more convenient to apply alignment once
> for all items, and the cases when per-item alignment is needed can be
> handled with margins. Something for WG to discuss.

No, I'm not aiming for exactly the same behavior.  The layout
algorithm, for example, is slightly different, which allows it to be
implemented more performantly than the old model.  So, changes from
the old model are okay with me.  I attempt to not make gratuitous
changes, though - it should remain easy to change existing content
over to the new model.

I was convinced against main-axis auto margins being flexible, since
they complicate the layout model without really working well (since
you can't control the flexibility - I liked them a lot more when they
accepted the flex() function).  So, the spec currently resolves them
to 0 instead (or should, if I accidentally left out the detail).  This
matches both Firefox's and WebKit's behavior for -prefix-box.

For consistency, cross-axis margins should do the same.  As far as I
can tell, this *also* matches Firefox's and WebKit's behavior.
Further, your examples clearly show that margins don't accomplish
anything beyond what flex-align already does, so it doesn't seem like
a valuable addition.

Given the above, I'd like to keep flex-align on the flexbox items.
The only downside of this is that you can't control the alignment of
anonymous items, but I don't think that's a big deal - anonymous items
only exist to keep the layout algorithm sane, not to provide useful
functionality that authors should depend on.  You can't control
properties of anonymous table-cells either, after all.

I previously had the thought that we could make flex-align inherit, so
you could specify it on the flexbox and have it inherit down to the
children when you want them all to align the same way, but
unfortunately that doesn't work, as a flexbox can, itself, be a
flexbox item.  There's no technical problems with it, but the
possibility for confusing unintended consequences for someone who
learns to specify alignment on the flexbox is high.

~TJ

Received on Wednesday, 7 December 2011 19:00:14 UTC