CSS change div order without flex

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

given a HTML of:

1
2
3
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-06 08:17

    You can use left and float: left;

    .class {
        position: relative;
        float: left;
        width: 25%;
       }
    
      .class:nth-child(1) {
        left: 75%;
      }
    
      .class:nth-child(2) {
        left: 25%;
      }
    
      .class:nth-child(3) {
        left: -25%;
      }
    
      .class:nth-child(4) {
        left: -75%;
      }
    

提交回复
热议问题