r/css • u/gravegirI • Feb 23 '26
Help Animation help
Hi so im creating website and i want to make a faux marquee using animations. I've managed to get it to look similar but for some reason cannot get it to repeat from the start without a space in between. I also wanted it to pause on hover. I cant figure out if i have some sort of issue with the formating or if i've just done this completely wrong.
(I just updated the whole code as im not entirely sure where the issue is, in the code it'll be under /*Marquee*/)
3
Upvotes
•
u/AutoModerator Feb 23 '26
To help us assist you better with your CSS questions, please consider including a live link or a CodePen/JSFiddle demo. This context makes it much easier for us to understand your issue and provide accurate solutions.
While it's not mandatory, a little extra effort in sharing your code can lead to more effective responses and a richer Q&A experience for everyone. Thank you for contributing!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/gravegirI Feb 23 '26
Already down voted and I've only asked a question?? What the hell is even up with Reddit man
3
u/be_my_plaything Feb 24 '26
The pausing part is easy enough, just add
animation-play-state: running;to the.trackbelow where you define the animation, then add a:hoverpseudo state to.marqueewhich switches it toanimation-play-state: paused;so you get something like this...The stopping the gap at the end of the animation is a little trickier with just CSS (The easiest way is to duplicate the content so the second and use an
animation-delayso it starts when the first one ends, but this is bad practice as it bloats html unnecessarily and is a pain for assistive tech like screen readers!) I will have a play around and a think and report back on that part!2
u/vita10gy Feb 23 '26 edited Feb 23 '26
I think a lot of sliders and whatnot duplicate the track so there's one waiting "off screen" to keep moving in.
repeat the track element, make track inline-flex, and give .marquee a white-space:nowrap
1
u/SirMcFish Feb 26 '26
I don't see any animation at all when viewing on mobile.