Can I use CSS to reverse the display order of two elements?

后端 未结 4 700
花落未央
花落未央 2021-01-15 08:41

This sounds crazy, but bear with me. I\'m writing a page that basically consists of the following:

4条回答
  •  迷失自我
    2021-01-15 09:13

    Yes, with flex boxes - http://jsfiddle.net/F8XMk/

    #container{
      display: flex;    
      flex-flow: column;
    }
    
    #child1{
      order: 2;
    }
    
    #child2{
      order: 1;    
    }
    

    Newer browser support for flex is pretty good. You could also hack your way through it with negative margins :)

提交回复
热议问题