Re: [css3-flexbox] absolutely positioned flexbox items

On Wed, Jan 4, 2012 at 11:42 AM, Tony Chang <tony@chromium.org> wrote:
> I have some questions about the static position of position:absolute flex
> items.
>
> The spec says, "If the element has two neighbors, its static position in the
> main axis is exactly in the center of the packing space between them when
> the flexbox is actually laid out."  This seems to only matter for
> flex-pack:justify (the only way there's packing space between items), but
> why the middle?  It's not hard to implement, but I wasn't sure what the use
> case is. I would expect the static position to just be immediately after the
> previous flex item.  E.g.:
>
> +------------------+
> |aaa bbb        ccc|
> +-------------------+
>
> Where bbb is a position:absolute flex item and aaa and ccc are flex items
> that are being positioned by flex-pack:justify.  The spec would do something
> like:
>
> +------------------+
> |aaa      bbb   ccc|
> +------------------+
>
> This doesn't seem that useful since bbb itself isn't centered, just the left
> edge is in the center between aaa and ccc.

If you know the dimensions of the abspos item, you can fully center it
with a negative margin.  Future improvements to the positioning model
may may centering even easier.

However, it's mostly that way because it seemed potentially useful.


> I also think the static position when there are no neighbors (i.e., a
> position:absolute flex item with no other flex items) is a bit unexpected. I
> wouldn't expect flex-pack to change the static position.

This was meant to give it a similar position to the other cases, as if
it was next to some zero-width neighbors, since flex-pack implicitly
changes its position in those cases.  I'm not opposed to it ignoring
flex-pack entirely, though.

Alex, any opinion?

~TJ

Received on Wednesday, 4 January 2012 19:51:02 UTC