Re: [css-grid] Absolutely positioned grid items

On Wed, Nov 12, 2014 at 1:58 PM, Manuel Rego Casasnovas <rego@igalia.com> wrote:
> Hi again,
>
> thanks for the previous answer, but I'd like to get a further clarification.
>
> It's related to grid descendants (but not direct children) that are
> absolutely positioned and their containing block is the grid container.
>
> For example:
> <div id="grid" style="display: grid; position: relative;">
>   <div id="item">
>     <div id="abspos" style="position: absolute;"></div>
>   </div>
> </div>
>
> In this case "abspos" is not a grid item (as it's not a direct child),
> however the containing block is the grid container. Thus, for "abspos"
> the containing block will correspond to the padding edges of the grid
> container.
>
> However, the grid-placement properties won't apply to "abspos" (as this
> is not a grid item). So it'll follow what's explained in "4.3. Static
> Position of Grid Container Children" and the behavior described in "8.4.
> Absolutely-positioned Grid Items" won't be used.
>
> On the other hand, if the absolute positioned element was the "item",
> then if it has non-auto grid-placement properties the behavior in 8.4
> will be used.
>
> So I guess that's the reason why there're 2 sections in the spec talking
> about this:
> * 4.3 will apply to any grid descendant, where the grid containing block
> is the grid. Not sure if it'd be nice to be more specefic that this
> includes any descendant and not only grid items (direct children).
> * 8.4 will apply to grid items (as its title said). Probably we could
> change "element" by "grid item" in that section to be more specific.
>
> I'd like just to know if my assumptions are right or not.
> What do you think?

No, we're just being sloppy with terminology in 8.4, and with the
"Applies to" lines in the propdef tables. ("Applies to" is just an
informative note, anyway.)

The grid-placement properties definitely apply to abspos elements
whose containing block is a grid container, even if they're not
children.  They alter the containing block to be the grid area
described by the properties (with the alteration, described in 8.4,
that an "auto" value *does* contribute a line, namely the
corresponding padding edge of the grid container).

I'll fix to make this clearer.

~TJ

Received on Wednesday, 12 November 2014 22:08:38 UTC