How to Stop a Marquee Automatically
If you already have the code for a CSS marquee, getting it to stop or pause is a piece of cake. You can pause a CSS marquee automatically at a given point, make it fly in then stop, or you can stop it based on user interaction (such as a hover over or mouseover).
Here, we pause the marquee half way through its iteration.
There would be a lot less code if we didn't use browser extensions (such as
-moz-. These have been added for maximum browser support. Feel free to remove these, but be aware that the marquee might not work across all browsers. However, once browsers catch up with the W3C standard, these browser extensions can be removed.
The above pause was achieved with the following code:
The first one is the W3C standard, the other two are browser-specific and can be removed once those browsers catch up to the W3C standard.
We effect the pause by using
margin-left: 0%; at the
60% points. For a longer pause you can widen the gap between these two percentage points. For example, you could use
70% or any other value.
To remove the pause altogether, simply remove those blocks of code:
Stop & Start Gradually
You can make the marquee stop and start slowly (rather than come to an abrubt halt, and accelerate away at the same speed).
To do this, simply replace
ease in the
animation declaration, so that the declaration looks like this:
Here's the result: