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

[css-grid] a few questions on auto-fill / auto-fit in the repeat() function

From: Mats Palmgren <mats@mozilla.com>
Date: Wed, 2 Dec 2015 21:32:04 +0100
To: www-style@w3.org
Cc: Daniel Holbert <dholbert@mozilla.com>
Message-ID: <565F5544.7030605@mozilla.com>

I have a few questions on auto-fill/fit.

1. On 'auto-fit' it says "except that after grid item placement
    any empty repetitions are dropped".  It's not clear how tracks
    are "dropped".  For example, how many columns does this grid have?
    <div style="display: grid;
                grid-template: repeat(auto-fit,100px) / 10px;
                width: 200px;">
      <item style="grid-column:2"></item>

    The text says we should "drop" empty tracks; column 1 is empty,
    column 2 is not empty; so we drop column 1, and the answer is
    that the grid has one column.  When I asked Daniel Holbert
    what he thought, he said "they probably only meant for empty
    tracks to be dropped from the end", which makes sense in
    retrospect.  If so, then I misunderstood what the text meant
    here so this definitely needs clarification in the spec text.
    (FWIW, I actually implemented the drop-empty-repeat-tracks-
    everywhere for 'auto-fit' and it's about a dozen extra lines
    of code compared to drop-empty-repeat-tracks-from-the-end
    version (in Gecko).  In case you've considered adding an
    'auto-compact' repeat keyword or something ;-) .)

2. The "Otherwise, the specified track list repeats only once."
    at the end of 'auto-fill' is slightly ambiguous for what it
    means for 'auto-fit'.  I'm guessing that 'auto-fit' can
    remove that last track too if it's empty?  Perhaps you could
    explicitly call that out under 'auto-fit', with for example:
    "This means that 'auto-fit' can result in zero tracks if all
    of them are empty."

3. I can't find a formal definition of what an "empty track" is.
    For example, "repeat(auto-fit,[a] 100px [b])" with a grid-aligned
    abs.pos. child placed between a and b - is that track empty?
    I assume it is, because of the general "such elements do not take
    up space or otherwise participate in the layout of the grid" note
    in 10.1, but it would be good to have a formal definition of it.

Received on Wednesday, 2 December 2015 20:32:36 UTC

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