-
Notifications
You must be signed in to change notification settings - Fork 756
Closed
Labels
css-grid-2Subgrid; Current WorkSubgrid; Current Work
Description
This proposal is rather simple; I'd like to allow 0 as a first argument to repeat(). The spec 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:
.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));
}This example breaks when setting --column-amount: 1, but it doesn't have to.
Although the use-case is admittedly relatively niche (yet I believe not insignificant), 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.
bleper
Metadata
Metadata
Assignees
Labels
css-grid-2Subgrid; Current WorkSubgrid; Current Work