The legacy <marquee> element used the loop attribute to control how many times moving content repeated. A positive number such as 3 requests three cycles; continuous movement was commonly written with a non-standard value such as infinite.
<marquee> is obsolete. Use CSS animations and animation-iteration-count to control how many times an animation repeats.These examples are retained for understanding and maintaining older pages.
<marquee style="font-family:Book Antiqua;color:#fff;background:#000080"
scrollamount="5" loop="1">
This is an example of Marquee (Loop: 1)
</marquee>
<marquee style="font-family:Book Antiqua;color:#fff;background:#000080"
scrollamount="5" loop="infinite">
This is an example of Marquee (Loop: Infinite)
</marquee>
infinite is legacy/non-standard usage. Do not copy it into new HTML.
<marquee style="font-family:Book Antiqua;color:#fff;background:#000080"
scrollamount="5" loop="3">
This is an example of Marquee (Loop: 3)
</marquee>
CSS uses animation-iteration-count. Set a positive number for a finite animation or infinite for continuous repetition.
<style>
.ticker {
display: inline-block;
animation: move-left 8s linear 3;
}
@keyframes move-left {
from { transform: translateX(100%); }
to { transform: translateX(-100%); }
}
</style>
<div class="ticker">Moves three times</div>
For continuous repetition, change the final value from 3 to infinite.
.ticker {
animation: move-left 8s linear infinite;
}
Repeated movement can distract or make content difficult to use. Respect users who request reduced motion.
@media (prefers-reduced-motion: reduce) {
.ticker {
animation: none;
}
}
If moving content carries important information, make sure the same information remains available when animation is disabled.
It controlled how many times legacy marquee content repeated its movement.
Older browsers may still interpret it, but marquee is obsolete and should not be used for new pages.
Use animation-iteration-count: 3, or include the value in the animation shorthand.
Use animation-iteration-count: infinite.
No. Loop controls repetition count; speed is controlled separately by legacy speed attributes or, in modern CSS, animation duration.
Yes. Disable or reduce non-essential motion when users request reduced motion.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.
18-06-2020 | |
| But why is their not any action taking place in both loop1 and loop3 | |
24-06-2020 | |
| loop1 and loop3 stops after completing their loops. You need to refresh the page to move them again. | |
28-11-2020 | |
| I used the marquee for a movie closing credits session on an "a href" button and combined it with a warning message box function But this marquee always runs before we open the link, how to make this marquee run only when we click the link, I think this using some sort of JS / jQuery | |
04-12-2020 | |
| You can keep a div or span tag in hidden by default. Make it visible ( inline ) only when the button is clicked. You can directly write the code with click event of the button. | |
26-09-2022 | |
| Sire, i know infinite loop , actually it's by default infinite while we using <marquee> tag....But I need endless loop.....Like the text never been end.....It's circular....Like it's end connected to head... Thanks | |