W3C home > Mailing lists > Public > www-style@w3.org > October 2015

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

From: Mats Palmgren <mats@mozilla.com>
Date: Thu, 8 Oct 2015 20:40:32 +0200
To: fantasai <fantasai.lists@inkedblade.net>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <5616B8A0.8080900@mozilla.com>
On 05/09/2015 01:11 AM, fantasai wrote:
 > On 03/24/2015 11:58 AM, Mats Palmgren wrote:
 >> Q3. what is the start and end lines for "grid-column: 99 / 100"
 >>      in a 3x3 grid?
 >> [... snip ...]
 >> 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.

Sorry for the late reply.  I just saw that this was added to the spec:
"If these properties don't define any explicit tracks, the explicit
grid still contains one grid line in each axis."

That sentence is problematic for several reasons:

1. If a line 1 is always present and explicit then the start column
    resolves to line 2 in the following example:

<div style="display:grid; grid-auto-columns:50px">
<span style="grid-column:A">A</span>

Which doesn't really make sense to me (I think it should start at
line 1 and it should be an implicit line).  If you really want it
at line 2, what would the rendering be? Is "A" indented 50px or
not?  Is there a track between line 1 and 2?

fantasai's answer above seems to suggest there is, not only an
always present explicit line 1, but also an associated zero-width
track?  The spec doesn't say anything about that though.

2. The alignment subjects for align-/justify-content are the tracks.
    Since there are no tracks in this case, line 1 is always at the
    content start edge and alignment has no effect on it.  This is
    confusing since if "grid-column:1" always matches a line for
    a grid-aligned abs.pos. box then it seems it should be always
    affected by alignment too.

<div style="display:grid; position:relative; justify-content:center">
<span style="position:absolute; grid-column:1">B</span>

3. Thus far the model has been that lines exist on each side of
    a track, and conversely that all numbered lines have a track
    in-between them.  No tracks <=> no lines.  The added sentence
    breaks that mental model.

As I suggested in my original mail above, I think all lines for
grid-aligned abs.pos. descendants should snap to the padding edge
when the grid has no tracks.  Then there is no need for the added
sentence and all the problems above disappears.

FWIW, the Grid implementation in Gecko rests on the invariant in
point 3 above.  It would be rather complicated for us to support
an explicit line without an associated track.  (A zero-width
track would solve that, but that doesn't seem to play well with
track distribution.)

BTW, the other issues I raised were discussed here:
but I don't see that this added sentence was actually discussed

Received on Thursday, 8 October 2015 18:41:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:57 UTC