JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="animation" style="
">
</div>
</body>
</html>
CSS
.animation {
background: lightblue;
width: 100px;
height: 100px;
animation: over-and-back 1.5s linear 3;
}
body {
background: black;
}
@keyframes over-and-back {
0% {
background: lightcoral;
}
50% {
transform: translate(150px);
}
100% {
transform: translate(0);
background: lightgray;
}
}