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

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

From: fantasai <fantasai.lists@inkedblade.net>
Date: Thu, 10 Dec 2015 16:44:55 -0500
To: Mats Palmgren <mats@mozilla.com>, www-style@w3.org
Cc: Daniel Holbert <dholbert@mozilla.com>
Message-ID: <5669F257.6090208@inkedblade.net>
On 12/02/2015 06:39 PM, Mats Palmgren wrote:
> https://drafts.csswg.org/css-grid/#valdef-repeat-auto-fill
>
> I have a few additional questions on auto-fill/fit:
>
> 4. How should a zero track size in the repeat() be handled?
>
> <div style="display: grid;
>              grid-template: repeat(auto-fill,0) / 10px;
>              width: 100px;">
>
> Clearly it's not possible to fill 100px with zero-sized tracks...

Good catch. CSS Multicol seems to have the same problem.
This is talked about in the wiki:
     https://wiki.csswg.org/spec/limited-ranges

We've added the following paragraph for now:

         For the purpose of finding the number of auto-repeated tracks,
         the UA must floor the track size to a UA-specified value
         to avoid division by zero.
         It is suggested that this floor be ''1px'' or less.

and will raise this with the WG.

> 5. ... except if you also have a non-zero 'grid-gap', so with
> grid-gap:20px you can fill the above grid with 6 tracks, resulting
> in 5 adjacent grid gaps.  How should these two cases be handled?

This seems like a silly case (auto-repeating zero-sized tracks),
so we're thinking nothing special should be done for subcases with
grid gap (that is, still floor the track size as above).

But we're open to other suggestions, if you have any. :)

> 6. In general, "positive integer" means one or more.  But it seems
>     undesirable to generate a track if it causes overflow so I'm really
>     not sure what you mean by that term here.
>     Please clarify if 'auto-fill' can result in zero tracks or if it
>     always generates at least one track when the size is definite.

Yes, it always generates at least one track. The auto-repeat
semantically indicates that you want to fill in some content
there, so it's likely confusing if it's possible to get
*nothing* to show up there. In the case that the window gets
too narrow, you still want at least one column to put the
content into--you don't want the auto-fill area to just
disappear.

> 7. When the size is indefinite, and the min size is definite but zero,
>     how many tracks should be generated?  for example:
>
> <div style="display: grid;
>              grid-template: repeat(auto-fill,10px) / 10px;
>              min-width: 0;">

The spec currently says
   “Otherwise, if the grid container has a definite min size
    in the relevant axis, the number of repetitions is the
    largest possible positive integer that fulfills that
    minimum requirement.”
which is actually an error, it should be s/largest/smallest/ :)
but in any case the requirement is "positive integer", so
one repetition, not zero.

~fantasai and TJ
Received on Thursday, 10 December 2015 21:45:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:31 UTC