Problem
Look at this Codepen: https://codepen.io/benface/pen/EqPxwB
If there's enough horizontal space, I would like the links to grow in width but only up to a certain amount (40 more pixels). So on a mobile device they would stay the same, but on a large screen they would be slightly wider, like this:

Possible solutions
.link { flex-grow: 1; }
- Result: FAIL, the links never stop growing and fill the container.

.link { flex-grow: 1; } .flex { max-width: 450px; margin: 0 auto; }
- Result: FAIL, this requires hardcoding a value that depends on the amount of links and their width. I'm looking for a solution that works all the time, no matter these variables.
.link { flex-grow: 0.1; }
- Result: FAIL, except for exactly one container width, but since the container is responsive, when the screen gets narrower the links get too small (not noticeably but still), and when it gets wider they get too large.
.link { flex-grow: 1; max-width: 90px; }
- Result: FAIL; after reaching the
max-width, a different amount of pixels has been added to each link because they have different default widths, which results in unequal gaps:

@media (min-width: 450px) { .link { padding: 10px 30px; } }
- Result: FAIL, requires hardcoding a value and the growing is not fluid.
Proposed solution
A new flex-max-grow (or max-flex-grow, or even flex-grow-max?) property that defines how much a flex item is allowed to grow:
.link {
flex-grow: 1;
flex-max-grow: 40px;
}
Problem
Look at this Codepen: https://codepen.io/benface/pen/EqPxwB
If there's enough horizontal space, I would like the links to grow in width but only up to a certain amount (40 more pixels). So on a mobile device they would stay the same, but on a large screen they would be slightly wider, like this:
Possible solutions
.link { flex-grow: 1; }.link { flex-grow: 1; } .flex { max-width: 450px; margin: 0 auto; }.link { flex-grow: 0.1; }.link { flex-grow: 1; max-width: 90px; }max-width, a different amount of pixels has been added to each link because they have different default widths, which results in unequal gaps:@media (min-width: 450px) { .link { padding: 10px 30px; } }Proposed solution
A new
flex-max-grow(ormax-flex-grow, or evenflex-grow-max?) property that defines how much a flex item is allowed to grow: