Skip to content

[css-grid-3] Allow <auto-repeat> (i.e. repeat(auto-fill|auto-fit, ...)) to accept intrinsic sizes #9321

@fantasai

Description

@fantasai

From @bfgeek in #9041:

One thing that seems desirable is to allow a wider/different syntax for rows/columns than is currently allowed for grid, e.g. masonry-template: repeat(auto-fill, auto).
(Above would measure all the masonry items, and select the best number of tracks to fit the content).
(Arguably above might be a better default than masonry-template: auto for example).
This isn't possible for grid-template for good reasons - but we could accept it for masonry.
One open question is if we need different track sizes or just one would suffice. All the designs I have personally seen have just one track repeated N times. Accepting just one track template would allow easier intrinsic sizing of spanners for example.

This is behavior probably doable (and desirable!) in Grid itself. A typical use case is a grid of cards, where the size of the cards isn't known (or is awkward to know) ahead of time when writing the stylesheet. We probably want to introduce new keywords to convey the "items contribute on all tracks" aspect of it, though, so that keyword track sizes within repeat() aren't treated differently to the identical keyword track sizes outside it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Tuesday Morning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions