.marquee {
display: flex;
overflow: hidden;
gap: 1rem /* whatever you want but match it */
position: relative;
user-select: none;
}
.marquee-content {
flex-shrink: 0;
display: flex;
justify-content: space-around;
min-width: 100%;
gap: 1rem; /* match to gap above */
}
@keyframes scroll {
from {
transform: translateX(0);
}
to {
transform: translateX(calc(-100% - 1rem)); /* match 1 rem to gap above */
}
}
.scroll {
animation: scroll 10s linear infinite;
}
<div class="marquee">
<div class="marquee-content scroll">
<div>TEXT</div>
<div>TEXT</div>
<div>TEXT</div>
<div>END</div>
</div>
<div class="marquee-content scroll">
<div>TEXT</div>
<div>TEXT</div>
<div>TEXT</div>
<div>END</div>
</div>
</div>
Inspired by: https://ryanmulligan.dev/blog/css-marquee/