StefanKovac/flex-layout-attribute

Centering seems to have failed in the online demo

xparq opened this issue · 1 comments

xparq commented

I was just playing around in the nice, and slightly addictive demo, until this state, where item 2, which claims to be centered, isn't. (I thought it may be vertical centering only, but item 1 has its horizontal position similarly displayed, and the parameter list also says "center" for the horizontal position.)

If it's indeed a problem, I think it happened right after setting "left" to item 1.

Anyway, HTH. Very nice work, nonetheless!

image

Thanks @lunakid!

You are right. To align item in the same direction as the main axis, margin hack is incorporated - flexbox provides a way to individually align item only on cross axis.

In the above case, when setting the item align to left, margin-right: auto; is applied to the item what makes other items push to the opposite direction.