Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<head>
<style>
#main
{
width: 400px;
height: 150px;
border: 1px solid red;
display: flex;
}
#main div
{
width: 70px;
height: 70px;
}
</style>
</head>
<body>
<div id="main">
<div style="background-color:yellow;" id="color1"></div>
<div style="background-color:black;" id="color2"></div>
<div style="background-color:yellow;" id="color3"></div>
<div style="background-color:black;" id="color4"></div>
</div>
<button onclick="myFunc()">click</button>
<script>
function myFunc() {
document.getElementById("color4").style.order = "1";
document.getElementById("color1").style.order = "2";
document.getElementById("color2").style.order = "3";
document.getElementById("color3").style.order = "4";
}
</script>
</body>
</html>
The most helpful JAVASCRIPT solutions
How can I get the last day and the next day in javascript ?JAVASCRIPT Click to see more ... 5.8K 507