CSS change div order without flex

前端 未结 3 1546
失恋的感觉
失恋的感觉 2021-01-06 08:00

given a HTML of:

1
2
3
3条回答
  •  醉话见心
    2021-01-06 08:29

    There are many possibilities. The sanest, of course, is to use flex, but if you don't want that, one way is to do it like this.

    .container {display: table;}
    .class {display: table-row;}
    .class:nth-child(3) {display: table-header-group;}
    .class:nth-child(2) {display: table-footer-group;}
    1
    2
    3
    4

提交回复
热议问题