Rearrange divs through css

后端 未结 1 828
清酒与你
清酒与你 2021-01-22 08:58

I have three 3 child div\'s with class span2, span7 and span3 respectively. When my browser width is below 763px I want it to be in this order span2, span3 and span7. How will I

相关标签:
1条回答
  • 2021-01-22 09:25

    You could achieve this by using flexible boxes layout and flex order like this:

    JSFiddle - DEMO

    .row-fluid > div {
        width: 100px;
        height: 100px;
        border: 1px solid red;
    }
    @media (max-width: 763px) {
        .row-fluid {
            display: flex;
            flex-wrap: wrap;
            flex-direction: column;
        }
        .span2 {
            order: 1;
        }
        .span7 {
            order: 3;
        }
        .span3 {
            order: 2;
        }
    }
    <div class="row-fluid">
        <div class="span2">span2</div>
        <div class="span7">span7</div>
        <div class="span3">span3</div>
    </div>

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