This question here has an answer, which leaves a lot of empty space at the end of each iteration of the marquee: CSS3 Marquee Effect
Is there a way to achieve a smooth <marquee></marquee>
effect, using CSS3, that doesn't leave this space?
I have a lot of small elements, which look a bit like SO's blue tags, that exclusively fill the content of the marquee, as opposed to one continuous body or a wall of text.
Here is a sample how you can do, and by setting the delay and duration you control the space between the texts
.marquee {
background-color: #ddd;
width: 500px;
margin: 0 auto;
overflow: hidden;
white-space: nowrap;
}
.marquee span {
display: inline-block;
font-size: 20px;
position: relative;
left: 100%;
animation: marquee 8s linear infinite;
}
.marquee:hover span {
animation-play-state: paused;
}
.marquee span:nth-child(1) {
animation-delay: 0s;
}
.marquee span:nth-child(2) {
animation-delay: 0.8s;
}
.marquee span:nth-child(3) {
animation-delay: 1.6s;
}
.marquee span:nth-child(4) {
animation-delay: 2.4s;
}
.marquee span:nth-child(5) {
animation-delay: 3.2s;
}
@keyframes marquee {
0% { left: 100%; }
100% { left: -100%; }
}
<p class="marquee">
<span>this is a</span>
<span>simple marquee</span>
<span>using css</span>
<span>only tech</span>
<span>with a delay</span>
</p>
CSS3 Marquee Effect, Without Empty Space
Horizontal Marquee
Horizontal with one right and one left : https://codepen.io/Rayeesac/pen/JjGEYRZ
Vertical Marquee
Vertical with one top and one bottom: https://codepen.io/Rayeesac/pen/eYJgpVy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With