Positon animation

by Kondal Durgam

HTML

<div class="parent">
  Parent
  <div class="child">
    Child Element
  </div>
</div>

CSS

html,
body {
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.parent {
  border: 2px solid #0074d9;
  padding: 20px;
  color: #000;
}

.child {
  border: 1px dotted #000;
  background-color: #eee;
  padding: 20px;
  position: relative;
  margin-top: 10px;
  animation: push ease 5s alternate infinite;
  animation-delay: 1.5s;
}

@keyframes push {
  0% {
    left: 0;
    top: 0;
  }
  50% {
    left: -100px;
    top: 100px;
  }
  100% {
    top: 50px;
    left: 50px;
  }
}