Example
<style>
#main {
width: 400px;
height: 200px;
border: 1px solid #ccc;
display: flex;
}
#main div {
width: 60px;
height: 60px;
}
div#grey {order: 0;}
div#blue {order: 1;}
div#pink {order: 2;}
div#red {order: 3;}
div#green {order: 10;}
</style>
<div id="main">
<div style="background-color:red;" id="red"></div>
<div style="background-color:green;" id="green"></div>
<div style="background-color:blue;" id="blue"></div>
<div style="background-color:pink;" id="pink"></div>
<div style="background-color:grey;" id="grey"></div>
</div>
Try it