Re: [csswg-drafts] [css-grid-1] Unpredicable gap positioning with two or more tracks. (#7197)

> The grid algorithm can't know that you actually want the 50fr to be as big as 25fr + 10px + 25fr in order to have the 1st gap centered at 50%.

This is the key point. What you're actually asking for is 4 columns with gaps in between, and for your items on the right to be spanning two of those columns. If you code it that way, the browser will handle all the math for you:

```
grid-template-columns: repeat(4, 1fr);
gap: 10px;
```

`fr` units aren't assigning percentages of the container to the columns, they're assigning fractions of the remaining space _after subtracting out the gaps_. The behavior you're seeing is correct; the reason you don't like the result is because it's the wrong way to solve your problem.

-- 
GitHub Notification of comment by fantasai
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7197#issuecomment-2762813166 using your GitHub account


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

Received on Friday, 28 March 2025 23:14:47 UTC