Here is my issue.
I've this basic layout based on CSS grid:
.title {
font-weight: bold;
}
.grid {
display: grid;
grid-template-columns: 1fr 3fr;
grid-gap: 1rem;
}
.grid > * {
border: 1px solid red;
}
<div class="grid">
<div class="title">Title 1</div><div>My Panel for Title 1</div>
<div class="title">Title 2</div><div>My Panel for Title 2</div>
</div>
As you can see, by default, I've 1 quarter for the first col, 3 quarters for the second one.
In this example, the second column is not so filled, but in the real case, i've got a whole panel with a lot of stuff inside.
I'd like that before squeezing a lot the big column, it squeezes the first one (which is always short, being just the title of the category) but when the first column is squeezed to its min size, the whole grid wraps so the title gets above each cell instead of being on its left.
So basically summed up:
- If I have tons of space, i want 1/4 3/4 layout.
- If the page is squeezed, i want the first column to be shrinked first.
- If the first column cannot be shrinked anymore (min-content is reached), then it wraps.
For the wrapping, i've a read a lot about repeat and auto-fit, but since it only takes one size configuration, i didn't figure out how to manage the 1fr/3fr case.
Do you have an idea about how i can handle this? Is it even feasible?
Thank you by advance!