JSFiddle - React, Tailwind, and code Playground
by Lalji Tadhani
July 03, 2019
HTML
<div class="marquee">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
<p>quis rem exercitationem perspiciatis ducimus repellat dicta sapiente totam aperiam repellendus eos libero.</p>
<p>Placeat hic magnam nostrum sit tempore labore ipsa rerum</p>
</div>
CSS
.marquee {
width: 100%;
height:30px;
overflow: hidden;
position: relative;
white-space:nowrap;
}
.marquee p {
width: auto;
height: 100%;
display:inline-block;
font-size:13px;
line-height: 20px;
margin: 0;
line-height: 30px;
text-align: center;
/* Starting position */
-moz-transform: translateX(100%);
-webkit-transform: translateX(100%);
transform: translateX(100%);
/* Apply animation to this element */
-moz-animation: scroll-left 30s linear infinite;
-webkit-animation: scroll-left 30s linear infinite;
animation: scroll-left 30s linear infinite;
}
@-moz-keyframes scroll-left {
0% {
-moz-transform: translateX(100%);
}
100% {
-moz-transform: translateX(-100%);
}
}
@-webkit-keyframes scroll-left {
0% {
-webkit-transform: translateX(100%);
}
100% {
-webkit-transform: translateX(-100%);
}
}
@keyframes scroll-left {
0% {
-moz-transform: translateX(100%);
/* Browser bug fix */
-webkit-transform: translateX(100%);
/* Browser bug fix */
transform: translateX(100%);
}
100% {
-moz-transform: translateX(-100%);
/* Browser bug fix */
-webkit-transform: translateX(-100%);
/* Browser bug fix */
transform: translateX(-100%);
}
}