Moving box animation using html and css

 

Moving box animation using html and css 

Code👇🏻

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>animation..</title>
  <style>
  body {background-color: black;}
 
  .box {
    background-color:#5BFF0F;
    width: 90px;
    height: 90px; }
   .box:hover {
    position: relative;
    animation-name: move;
    animation-delay: 0s;
    animation-duration: 4s;
    animation-iteration-count: infinite;
    animation-direction: alternate-reverse; }
 
  @keyframes move {
  0%   {background-color:red; left:0px; top:0px;}
  25%  {background-color:yellow; left:252px; top:0px;}
  50%  {background-color:blue; left:252px; top:252px;}
  75%  {background-color:green; left:0px; top:252px;}
  100% {background-color:red; left:0px; top:0px;}
}

  </style>
</head>
<body>
  <h2 style="text-align:center;color:blue"> touch box </h2>
  <div class="box"></div>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <h2 style="text-align:center;color:#00F800"> moving box animation</h2>
  <h3 style="text-align:center;color:red">plz guys give me your valuable star 🌟</h3>
</body>
</html>