[go: up one dir, main page]

Re: [css-flexbox] new abspos logic

On Wed, Apr 8, 2015 at 6:25 PM, Christian Biesinger
<cbiesinger@google.com> wrote:
> More questions on http://dev.w3.org/csswg/css-flexbox/#abspos-items -
>
> So the spec says:
> "In other words, the static position of an absolutely positioned child
> of a flex container is determined after flex layout by setting the
> child’s static-position rectangle to the flex container’s content box,
> then aligning the absolutely positioned child within this rectangle
> according to the justify-content value of the flex container and the
> align-self value of the child itself"
>
> I'm not completely sure how to interpret that especially in the case
> of auto margins. For example, given align-self: flex-end but margin:
> auto 0. Am I supposed to take a similar approach to the flex algorithm
> and ignore the flex-end here (because the margins centered it)...? Or
> should I ignore the margins and align it to flex-end because that
> matches this text more closely, even though it seems to contradict the
> previous paragraph a bit (which implies that only the static position
> is affected).

I've removed that paragraph.  It's just trying to rephrase the
previous paragraph, but it's doing so badly.  The previous paragraph
gives the correct behavior - treat it like it's a lone flex item and
do normal flex alignment (with all sizes fixed, so only alignment
occurs).  This really just means that, depending on margins and
alignment properties, it'll be start/center/end in each axis of the
flexbox's content box, but the more general text is easier to define
and handles any future values we add to the alignment properties
correctly.

> In fact, a strict reading of the quoted paragraph implies that
> align-self/justify-content override other alignment methods (e.g.
> top:0 bottom:0)...

No it doesn't; this is defining the static position.  The static
position doesn't take top/etc into account, and isn't used when
top/etc are non-auto.

~TJ

Received on Tuesday, 5 May 2015 23:16:14 UTC