How can I reorder my divs using only CSS?

后端 未结 24 1470
傲寒
傲寒 2020-11-22 01:53

Given a template where the HTML cannot be modified because of other requirements, how is it possible to display (rearrange) a div above another div

24条回答
  •  被撕碎了的回忆
    2020-11-22 02:15

    In your CSS, float the first div by left or right. Float the second div by left or right same as first. Apply clear: left or right the same as the above two divs for the second div.

    For example:

    #firstDiv {
        float: left;
    }
    
    #secondDiv {
        float: left;
        clear: left;
    }
    

提交回复
热议问题