Animate CSS order property


To implement animation on order property with CSS, you can try to run the following code

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         #demo1 {
            width: 600px;
            height: 180px;
            display: flex;
         }
         #inner {
            animation: myanim 3s infinite;
         }
         #demo1 div {
            width: 110px;
            height: 180px;
         }
         @keyframes myanim {
            30% {
               order: 4;
            }
         }
      </style>
   </head>
   <body>
      <h1>CSS order property</h1>
      <div id = "demo1">
         <div style = "background-color:yellow;order:1;" id = "inner"></div>
         <div style = "background-color:blue;order:2;"></div>
         <div style = "background-color:orange;order:3;"></div>
         <div style = "background-color:pink;order:4;"></div>
         <div style = "background-color:gray;order:5;"></div>
         <div style = "background-color:maroon;order:6;" id="inner"></div>
      </div>
   </body>
</html>

Updated on: 25-Jun-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements