Rearrange divs through css

后端 未结 1 829
清酒与你
清酒与你 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;
        }
    }
    span2
    span7
    span3

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