Re: [css-align] Clarification on the concept of 'parent' for Self Alignment 'auto' value resolution
"Tab Atkins Jr." <[email protected]>
| Newsgroups | gmane.comp.web.css.general |
|---|---|
| Message-ID | <CAAWBYDBxMgj9V25iGawd2Osn1_JDpU+ZFs1KVwYgZwJ=AUnMZw@mail.gmail.com> |
On Mon, May 30, 2016 at 5:27 AM, Javier Fernandez <[email protected]> wrote: > Sorry if this question is seen as a pure implementation detail, but I'm > finding some problems to properly implement 'auto' value resolution in > some cases. Both the Flexbox and Box Alignment specification use the > concept "element's parent" to indicate the Default Alignment > value to be used for resolving 'auto' values of children's Self > Alignment properties. > > >From the Flexible Box spec: > > "On absolutely positioned elements, a value of auto computes to itself. > On all other elements, a value of auto for align-self computes to the > value of align-items on the element’s parent, or stretch if the element > has no parent." > https://drafts.csswg.org/css-flexbox/#align-items-property > > >From the Box Alignment spec: > > "The auto keyword computes to the computed value of justify-items on the > parent (minus any legacy keywords), or normal if the box has no parent." > https://drafts.csswg.org/css-align/#align-self-property > > It may seems like obvious, but, I'd like a direct clarification of what > "parent" means here. Is it the HTML element's parent or the "parent box" > generated when elements are laid out ? > > My question comes from the fact that some layout models may add an > anonymous box > as parent for elements with 'auto' values in their Self Alignment > properties. There won't > be a direct CSS rule indicating the Default Alignment value these 'auto' > values will be resolved against. It'd depend on the values set, at > layout time, to those anonymous > parents. Anonymous boxes are, as the name suggests, *boxes* - they show up in the box tree, which is constructed *from* the element tree. "Parent element" refers to the element tree; it doesn't care about box-tree structure. (And so there's no layout-time determination; this behavior can instead be resolved at inheritance time.) ~TJ