Fullwidth and multiple columns using flexbox

后端 未结 1 1166
南旧
南旧 2020-12-11 17:17

I\'m trying to create a flexbox row with fullwidth and multiple columns on the same container.

I\'ve tried flex-break: after; but am not su

1条回答
  •  萌比男神i
    2020-12-11 18:09

    You need to set flex-wrap: wrap on flex container, and then flex: 0 0 100% on full-width items and flex: 0 0 50% on half-width items. Also you should add box-sizing: border-box.

    * {
      box-sizing: border-box;
    }
    .collage {
      display: flex;
      flex-wrap: wrap;
    }
    .collage-item {
      border: 1px solid black;
      flex: 0 0 50%;
      padding: 10px;
    }
    .fullwidth {
      flex: 0 0 100%;
    }
    a
    b
    c
    d

    0 讨论(0)
提交回复
热议问题