div { background: #ff0000; } .bound { animation: key .3s ease infinite alternate; } @keyframes key { 0% {transform: translateY(0px);} 100% {transform: translateY(-10px);} }