Align 2 DIV per line, both the with the same height

前端 未结 4 1815
别那么骄傲
别那么骄傲 2021-01-26 20:40

We have a problem where we need to have a list of divs with dynamic content. There will always be 2 divs per row. Both of those elements should have the same height.

Cur

4条回答
  •  死守一世寂寞
    2021-01-26 21:09

    I use flexbox, it's magic ^^ :

    HTML

    CSS

    .boxes {
      display: flex;
      flex-wrap: wrap;
    }
    .box {
       margin: 0 1% 1% 0;
       width: 48%;
    }
    

    CODEPEN DEMO

    Complete guide to flexbox on css-trick

提交回复
热议问题