order: integer | initial | inherit;
<!DOCTYPE html>
<html>
<head>
<style>
body {
text-align: center;
}
.container {
display: flex;
background-color: blue;
height: 150px;
width: auto;
flex-wrap: wrap;
}
div {
background-color: cyan;
line-height: 40px;
color: black;
padding: 10px;
text-align: center;
font-size: 35px;
width: 100px;
margin: 20px;
}
</style>
</head>
<body>
<h1> CSS order Property </h1>
<div class="container">
<div style="order: 3"> 1 </div>
<div style="order: 0"> 2 </div>
<div style="order: 0"> 3 </div>
<div style="order: 1"> 4 </div>
<div style="order: -1"> 5 </div>
<div style="order: 2"> 6 </div>
<div style="order: 1"> 7 </div>
<div style="order: -2"> 8 </div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
.container {
padding: 0;
margin: 0;
list-style: none;
display: flex;
}
.list {
padding: 5px;
width: 100px;
height: 100px;
margin: 5px;
line-height: 100px;
color: black;
font-size: 30px;
text-align: center;
}
</style>
</head>
<body>
<h2>Order property</h2>
<ul class="container">
<li class="list" style="order: 5; background-color: orange;">1</li>
<li class="list" style="order: -1; background-color: lightblue;">2</li>
<li class="list" style="order: 1; background-color: yellow;">3</li>
<li class="list" style="order: 2; background-color: red;">4</li>
<li class="list" style="order: 0; background-color: cyan;">5</li>
</ul>
</body>
</html>