[csswg-drafts] [css-grid] Allow 0 in repeat() (#9371)

vrugtehagel has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-grid] Allow 0 in repeat() ==
This proposal is rather simple; I'd like to allow `0` as a first argument to `repeat()`. [The spec](https://drafts.csswg.org/css-grid/#repeat-notation) defines the argument to be `<integer [1,∞]>`. Can we loosen it to `<integer [0,∞]>`? The primary use-case for this is when using custom properties for the amount of rows or columns in a grid. For example:

```css
.grid {
    --column-amount: 3;
    --first-column-width: 200px;
    --default-column-width: 1fr;
    display: grid;
    grid-template: auto
        / var(--first-column-width) repeat(calc(var(--column-amount) - 1), var(--default-column-width));
}
```

the use-case is admittedly relatively niche (though I believe not insignificant) but it seems to be very low-cost to allow this.

Semi-formally, `repeat(0, ...)` just ends up being ignored in the declaration. So, `auto repeat(0, 1fr) 200px` would be equivalent to `auto 200px`.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9371 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 18 September 2023 09:30:22 UTC