.my-div{
background-color: #f00;
animation: animationname 2s linear infinite;
/*animation: animation-name animation-duration animation-direction animation-iteration-count */
transition: .5s ease-in-out;
}
@keyframes animationname{
0%{
transform: translateX(10px);
}
100%{
transform: translateX(-10px);
}