JSFiddle - React, Tailwind, and code Playground
by luka kupunia
HTML
<div class="body">
<div id="box1" class="box">Hi iam luka from georgia</div>
<div id="box2" class="box">1</div>
</div>
CSS
body {
margin: 0;
overflow: hidden;
}
* {
box-sizing: border-box;
}
div.body {
white-space: nowrap;
position: relative;
}
div.body:after {
content: '';
display: table;
clear: both;
}
div.box {
float: left;
padding: 50px;
background: linear-gradient(to left ,hsla(300, 56%, 18%, 1),purple);
color: white;
font-size: 40px;
text-align: center;
}
div#box2 {
left: 99.9%;
background: linear-gradient(to left ,purple, hsla(300, 56%, 18%, 1));
animation: two 10s linear infinite 5s;
}
div#box1 {
animation: one 10s linear infinite;
transform: translateX(100%);
}
div.body:hover div.box {
animation-play-state: paused !important;
}
@keyframes one {
from {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
}
@keyframes two {
100% {
transform: translateX(-200%);
}
}
JavaScript
var a = document.getElementById('box1');
var b = document.getElementById('box2');
b.innerHTML = a.innerHTML;