代码
提交代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> .demo{ display: flex; } .child-1{ flex:auto; order:2; background: #000; } .child-2{ flex:auto; order:1; background: rgb(255, 2, 2); } </style> </head> <body> <div class="demo"> <div class="child-1"> 1 </div> <div class="child-2"> 2 </div> </div> </body> </html>
运行结果