Collapsible div inside a CSS grid container expands full width

两盒软妹~` 提交于 2020-05-17 10:08:38

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!