JSFiddle - React, Tailwind, and code Playground
HTML
<div class="box"></div>
CSS
.box {
width: 100px;
height: 100px;
background: olive;
}
/* following code is not working in IE & Safari */
/* .fadein-left {
-webkit-animation: fadeInLeft 1s 2s both running;
animation: fadeInLeft 1s 2s both running;
} */
/* works perfectly in all browser */
.fadein-left {
-webkit-animation: fadeInLeft 1s 2s both;
animation: fadeInLeft 1s 2s both;
-webkit-animation-play-state: running;
animation-play-state: running;
}
@-webkit-keyframes fadeInLeft {
0%{ -webkit-transform: translateX(-100px); opacity: 0; }
100% { -webkit-transform: translateX(100px); opacity: 1; }
}
@keyframes fadeInLeft {
0%{ transform: translateX(-100px); opacity: 0; }
100% { transform: translateX(100px); opacity: 1; }
}
JavaScript
document.querySelector('.box').classList.add('fadein-left');