Arrange 2 items per row using flexbox

后端 未结 2 527
暗喜
暗喜 2020-12-23 13:17

Imagine I have following markup

<
2条回答
  •  半阙折子戏
    2020-12-23 13:44

    you can give flex: 0 50% to children divs without touching .item

    .item {
      width: 100%
    }
    
    .container {
      display: flex;
      flex-wrap: wrap;
    }
    
    .container>div {
      flex: 0 50%;
      /*demo*/
      border: red solid;
      box-sizing:border-box
    }
    1
    2
    3
    4

提交回复
热议问题