问题
I have a group of expandable divs inside a CSS grid container. I am using Polymer framework and its iron-collapse component.
Codepen - https://codepen.io/vijayvmenon/pen/ZEYKZMX
CSS:
.card {
display: grid;
grid-template-columns: repeat(auto-fill,minmax(400px,1fr));
grid-column-gap: 30px;
}
.container {
display:flex;
flex-direction:column;
border:1px solid black;
}
The CSS should be pretty straightforward. When I click on any div, the other divs in the row also expand. How can I fix this by expanding only the div I clicked and not expanding the other divs in the row? Any help is appreciated.
I need the layout to be responsive and that is why I am using Grid and Flexbox. The actual page has more components inside the div with "card" class, all of which needs to be responsive. Any solution that still maintains the responsiveness should work for me.
来源:https://stackoverflow.com/questions/59462832/collapsible-div-inside-a-css-grid-container-expands-full-width