I'm trying to make a 3x3 grid with items that can be expanded and collapsed. When the user clicks on an item that item will expand and push items below it the same column down but the other items in the same row will keep their default height.
The application is a VueJS application. I have tried using display: grid
and display: flex
but both those solutions will change the height of the entire row to match the new height of the expanded item.
// flex solution
.container {
display: flex;
justify-content: space-evenly;
flex-flow: row wrap;
}
//...
.item {
min-width: 33.33%;
height: auto;
}
// grid solution
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: minmax(150px, auto)
}
How do you prevent the other items from being affected by the new height of the expanded item?