Flexbox 3 divs, two columns, one with two rows

前端 未结 2 1228
猫巷女王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:46

    The Legit Method:
    *Recommended

    .flex-row {
        flex-direction: row;
        display: flex;
    }
    
    .flex-column {
        flex-direction: column;
        display: flex;
    }
    
    .flex-body {
        display: flex;
    }
    
    .flex-body div:not([class*="flex"]) {
        border: 1px solid white;
        flex: 1 1 200px;
        width: 300px;
    }

    The Hackish Method:
    *Not Recommended (I'm sure you'll notice why)

    .flex-body {
        display: flex;
        flex-direction: row-reverse;
        flex-wrap: wrap;
        justify-content: flex-end;
        align-content: stretch;
        align-items: stretch;
        transform: rotate(90deg);
        max-width: 500px;
        margin: auto;
    }
    
    .flex-body div {
        border: 1px solid white;
        height: 300px;
        flex: 1 1 200px;
    }
    
    .flex-body div:last-of-type {
        flex: 1 1 300px;
        height: 300px;
    }

提交回复
热议问题