Re: [css-grid] How to resolve lines for absolutely positioned grid items

On 03/24/2015 11:58 AM, Mats Palmgren wrote:
> Hi,
>
> I'm implementing Grid layout for Gecko and I have a few questions
> on how lines should be resolved for abs.pos. grid items.
> (I'm including a full example inline at the bottom)
>
> Q1. what is the end line for "grid-column: auto / span 2" ?
>
> My understanding is that "span 2" means "cover two tracks"
> just as it does for normal flow grid items, i.e. line 3.
> Is that correct?

Well, for abspos items 'auto' indicates the special line at the grid
container's padding edge. Since we hadn't defined the relationship
of this line to the rest of the grid, the answer to your question
wasn't defined... We think the best answer would be to define that
the 'auto' lines come before/after the rest of the grid, so this
would span from the 'auto' line (the +0th line) to the +2nd line.

Let us know if this doesn't seem to make sense.

This issue is tracked as
   http://dev.w3.org/csswg/css-grid-1/issues-wd-20150108#issue-2

> Q2. what is the end line for "grid-column: auto / span A" ?
> http://dev.w3.org/csswg/css-grid/#grid-placement-errors
> third paragraph says it should be treated as "span 1"
> which seems undesirable for abs.pos. grid items.
>
> (I would like the answer to cover both when line A exists
> and when it doesn't exist.)

Since 'auto' contributes a line, not a span, for absolutely-positioned
items, this case wouldn't trigger the "span 1" error handling, and
would instead span from the start padding edge to line A.

We didn't say what happens when line A doesn't exist, so we've added
wording to create implicit lines (which have all names) for abspos
items for lines that don't exist. We also defined that the new tracks
so created have zero size, so this would therefore span to either
line A (if it exists) or to an implicit line placed at the same
position as the last grid line (if it doesn't).

If you start with "grid-column: span A / span B", which gets around the
"auto contributes a line" behavior, this first triggers the "two spans"
error handling, then the "span 1" error-handling, *then* we have
another error-handling step just for abspos that catches it and makes
it the same as originally just specifying "auto / auto".

This is just our initial thoughts; we haven't closed on this issue yet,
so your thoughts on it are welcome.

Handling missing lines for abspos positioning is tracked as
   http://dev.w3.org/csswg/css-grid-1/issues-wd-20150108#issue-3

> Q3. what is the start and end lines for "grid-column: 99 / 100"
>      in a 3x3 grid?
>
> I think first clamping the lines to the implicit grid bounds
> makes sense ("4 / 4").  And then the error handling:
> http://dev.w3.org/csswg/css-grid/#grid-placement-errors
> (first paragraph says "it instead contributes nothing")
> makes it "4 / auto".  So the containing block will cover
> the area between the end of the grid to the padding-edge on
> the right side.  Is that correct?

Since we didn't define this case, we're not sure which is correct. :)
Your proposal makes sense. Another option, which we think is a bit
simpler, is to add implicit lines as described above for missing
named lines. This example would end up adding the abspos into a
zero-width track at the end of the grid.

> And what is the answer to Q3 if the grid has no tracks at all?
> (same as "auto / auto" ?)

Tab suggests that we force the explicit grid to always have
at least one grid line. The example above would then end up
in a zero-width track in a mostly-empty grid of zero-width
tracks.

Let us know what you think.

~fantasai and TJ

Received on Friday, 8 May 2015 23:11:29 UTC