How can I reorder my divs using only CSS?

后端 未结 24 1165
傲寒
傲寒 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:19

    .move-wrap {
        display: table;
        table-layout: fixed; // prevent some responsive bugs
        width: 100%; // set a width if u like
        /* TODO: js-fallback IE7 if u like ms */
    }
    
    .move-down {
        display: table-footer-group;
    }
    
    .move-up {
        display: table-header-group;
    }
    

提交回复
热议问题