HTML CSS examples for CSS Layout:Flex Item
Using flex order property to re-arrange items
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .container {<!--from w w w .ja v a 2s. c om--> display: flex; flex-direction: column; height: 200px; } div.orange { background-color: orange; } div.blue { order: -1; background-color: aqua; } div.green { background-color: lightgreen; } .container > div { width: 100%; flex: 1; display: flex; align-items: center; justify-content: center; } /***************************/ @media screen and (min-width:800px) { .container { flex-wrap: wrap; } div.orange { flex-basis: 100%; width: 50%; } div.blue { flex-basis: 50%; width: 50%; order: 0; } div.green { flex-basis: 50%; width: 50%; } } </style> </head> <body> <div class="container"> <div class="orange"> 1 </div> <div class="blue"> 2 </div> <div class="green"> 3 </div> </div> </body> </html>