Flexbox 3 divs, two columns, one with two rows

前端 未结 2 1235
猫巷女王i
猫巷女王i 2020-12-09 10:49

I am trying to take

Three sequential divs and turn it into below. W

2条回答
  •  清歌不尽
    2020-12-09 11:33

    After thinking about this a little more, it is possible with flexbox. The container just has to have a defined height (%, px or vh) will work.

    http://codeply.com/go/U1DCKAx85d

    body {
      display: flex;
      flex-wrap: wrap;
      flex-direction: column;
      height: 100vh;
    }
    
    .a {
      flex: 0 0 100%;
      background: red;
    }
    
    .b, .c {
      flex: 0 0 50%;
      background: green;
    }
    
    .c {
      background: blue;
    }
    

提交回复
热议问题