With Flex, I can wrap using flex-wrap. I'm experimenting with CSS grid and want to wrap an element but can't find a way to do that. Is it possible?
Here is my code
.item1 {
grid-area: topic;
}
.item2 {
grid-area: user;
}
.item3 {
grid-area: bin;
}
.bin-grid {
display: grid;
grid-template-columns: 200px auto;
grid-template-areas: 'topic topic topic' 'user bin bin';
gap: 0;
padding-bottom: 15px;
margin-bottom: 20px;
}
<div class="bin-grid">
<div class="item1">Header</div>
<div class="item2">Left</div>
<div class="item3">Right</div>
</div>
I tried using grid-template-columns:200px auto; but that isn't wrapping the elements. I need item2 and item3 to wrap.
After a link that was posted by a SO user for the same issue, I tried using grid-template-columns:repeat(auto-fill, 186px)
but the elements will not wrap in my case. Yet, I can see the example works just fine. I'm not sure why it won't work in my case.