<div class="square"/>
.square {
  width: 50px;
  height: 50px;
  
  animation: moveInSquare 4s both infinite;
}

@keyframes moveInSquare {
  0%, 100% {
    transform: translate(0px, 0px);
    background-color: red;
  }
  25% {
    transform: translate(100px, 0px);
    background-color: orange;
  }
  50% {
    transform: translate(100px, 100px);
    background-color: yellow;
  }
  75% {
    transform: translate(0px, 100px);
    background-color: green;
  }
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.