At the end of the animation the text is completely disappearing I want to show it from right the text which is disappearing I don’t want to disappear the text completely
.wrapper {
position: relative;
overflow: hidden;
height: 25px;
width: 100%;
border: 1px solid orange;
}
.wrapper p {
position: absolute;
margin: 0;
line-height: 25px;
white-space: nowrap;
animation: marquee 5s linear infinite;
}
@keyframes marquee {
0% { transform: translateX(100%); }
100% { transform: translateX(-100%); }
}
<div class="wrapper">
<p>Hey, how you're doing? Sorry you can't get through.</p>
</div>
2
Answers
Hope that work for you and got your answer 🙂
This animation means to move the div from its original position + 100% of its width, to its original position -100% of its width (which is to the left of its original position).
Using
transform: translateX(0%)
should move it to its original position.You would have to change
animation
parameters in.wrapper p
so that the animation doesn’t keep repeating, and since the distance covered is now shorter, the speed would be slower than intended.From
animation: marquee 5s linear infinite;
toanimation: marquee 2s linear
;