RE: [css3-flexbox] alignment test

± From: Tab Atkins Jr. [mailto:jackalmage@gmail.com] 
± Sent: Wednesday, December 07, 2011 10:59 AM
± 
± 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.

Consistency is a good thing, but it is just one of the reasons to consider. In normal flow, 'margin-left' and 'margin-right' work for alignment, but 'margin-top' and 'margin-bottom' don't (and those collapse too). 

The margin alignment in 2009 spec is *consistent* with normal flow: if you change a container from "display:block" to "display:box;box-orient:vertical", children preserve their horizontal alignment.

± 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 actually think applying 'flex-align' to flexbox is actually a good idea.

 1) In vast majority of cases all flex items have same alignment
 2) Exceptional cases where per-item alignment is needed are easily handled with margins (as my example shows)
 3) Alignment applies to anonymous items

I realize that the above benefits are not super strong, but I don't really see what value per-item alignment brings to offset those... 

I think we went for per-item alignment just because we didn't realize that auto margins can be useful there. If it was a mistake we can still fix it.

Alex

Received on Saturday, 10 December 2011 03:35:43 UTC