Reputation: 32767
Using CSS Grid, this is what I am trying to achieve:
I've tried with:
nav {
display: grid;
grid-template-columns: auto 10%;
}
But that 10%
might still be smaller, depending on the content that's on that column. How can I make it as small as possible whilst being a width-variable field?
Upvotes: 3
Views: 2094
Reputation: 32767
You can do that with Grid by using max-content
or min-content
.
nav {
display: grid;
grid-template-columns: auto max-content;
}
max-content
Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track.
min-content
Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track.
Upvotes: 2