Understanding the Legacy
The <marquee> element holds a special place in web development history as one of the most recognizable--and now deprecated--HTML tags. While it once provided a simple way to create scrolling text and images, modern web development demands more performant, accessible, and standards-compliant approaches.
The <marquee> element originated in early web browsers as a proprietary Microsoft extension before being adopted widely across the web. It enabled developers to create animated content simply by wrapping text or images in a tag, without requiring JavaScript or CSS knowledge.
As part of our commitment to building modern websites with cutting-edge technologies, we follow web standards and best practices that ensure your site remains compatible with future browser updates. For developers working with modern JavaScript, understanding how to replace legacy elements like marquee with CSS animations connects directly to our JavaScript fundamentals guide, which covers data handling and DOM manipulation patterns that support interactive web experiences.
Why the Element Was Deprecated
The <marquee> element was deprecated for several compelling reasons that reflect the web's evolution toward higher standards.
Non-Standard Status
The element was never part of any official HTML specification, operating as a de facto standard based on browser implementations. This non-standard status meant inconsistent behavior across browsers and no formal specification to guide developers.
Accessibility Barriers
Marquee animations created substantial accessibility barriers for users with vestibular disorders, cognitive distractions, or visual impairments. The constant motion could trigger motion sickness, make content difficult to read, and create barriers for screen reader users trying to navigate the page.
Performance Issues
From a performance perspective, <marquee> relied on browser-rendering mechanisms that were less efficient than modern CSS-based animations. The element's continuous repainting during animation cycles consumed CPU resources unnecessarily, particularly noticeable on mobile devices and lower-powered computers.
Our approach to web performance optimization ensures every element on your site contributes to a fast, smooth user experience. When implementing accessible animations, we follow guidelines that align with accessible design principles that respect user preferences and provide inclusive experiences across all abilities.
The Original Marquee Attributes
Before the element's deprecation, developers used these key attributes to control marquee behavior:
| Attribute | Purpose | Values |
|---|---|---|
behavior | Controls scroll type | scroll, slide, alternate |
direction | Sets scrolling direction | left, right, up, down |
scrollamount | Scrolling speed in pixels | Numeric value (default: 6) |
scrolldelay | Delay between movements | Milliseconds (default: 85) |
loop | Number of times to scroll | Numeric or -1 for infinite |
bgcolor | Background color | Color name or hex value |
<marquee direction="right" scrollamount="10">
This text scrolls from right to left
</marquee>
While understanding these attributes helps when maintaining legacy code, implementing scrolling effects today requires a completely different approach using CSS animations. Our front-end development services include modernization of legacy codebases. For teams working with semantic HTML, replacing deprecated elements with proper semantic structures is covered in our table and DOM element documentation.
The Modern CSS Approach
Contemporary marquee implementations use CSS animations to achieve identical visual effects while adhering to web standards and best practices.
Fundamental Technique
The fundamental technique involves animating the transform property to translate elements across the viewport, creating the illusion of continuous scrolling. This approach offers several advantages:
- Hardware acceleration for smooth performance through GPU compositing
- Precise control over animation timing and easing functions
- Accessibility compatibility with user preference settings
- Separation of concerns between presentation and markup
Basic Horizontal Marquee
A basic horizontal marquee effect requires three essential components:
- A container with
overflow: hiddenestablishes the visible viewport - A flexbox layout arranges the scrolling content horizontally
- CSS keyframes define the translation animation
.marquee-container {
overflow: hidden;
white-space: nowrap;
}
.marquee-content {
display: inline-block;
animation: scroll 20s linear infinite;
}
@keyframes scroll {
from { transform: translateX(0); }
to { transform: translateX(-100%); }
}
This CSS-first approach aligns with our philosophy of using progressive enhancement to deliver modern experiences while maintaining broad compatibility across browsers and devices.
Seamless Infinite Scroll
For the seamless infinite scroll effect that marquee traditionally provided, developers employ a technique involving duplicate content.
Content Duplication Technique
By placing two copies of the content side by side and animating them together, the animation can loop without visible gaps when the first copy exits the viewport and the second copy continues the sequence.
<div class="marquee">
<div class="marquee-content">
<span>Item 1</span>
<span>Item 2</span>
<span>Item 3</span>
<span>Item 4</span>
<span>Item 5</span>
</div>
<div class="marquee-content" aria-hidden="true">
<span>Item 1</span>
<span>Item 2</span>
<span>Item 3</span>
<span>Item 4</span>
<span>Item 5</span>
</div>
</div>
.marquee {
display: flex;
overflow: hidden;
}
.marquee-content {
display: flex;
animation: scroll 10s linear infinite;
}
@keyframes scroll {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
}
This approach creates the smooth, continuous motion that made marquees popular for displaying news tickers, stock prices, promotional announcements, and logo slideshows. We apply these techniques when building custom web applications that require dynamic visual elements.
Key considerations for implementing performant and accessible scrolling effects
Use CSS Transforms
Always animate the transform property for hardware-accelerated performance. Avoid animating left, margin, or padding which trigger expensive layout recalculations.
Respect Reduced Motion
Implement prefers-reduced-motion media queries to pause or disable animations when users have configured their system to minimize motion.
Hardware Acceleration
Leverage GPU compositing through transform: translate3d() for smooth 60fps animations on mobile devices and low-power computers.
Semantic HTML
Use proper semantic elements and ARIA attributes to ensure screen reader compatibility. Consider aria-live for dynamic content updates.
Advanced CSS Techniques
The evolution of CSS has introduced more sophisticated approaches to marquee creation.
CSS Offset with Shape Function
Modern CSS properties like offset combined with the shape() function enable developers to define precise motion paths using CSS syntax rather than hardcoded values:
.marquee-item {
offset-path: shape(horizontal, 100%);
animation: move 5s linear infinite;
}
@keyframes move {
from { offset-distance: 0%; }
to { offset-distance: 100%; }
}
Responsive Considerations
For marquees that adapt to different screen sizes, use CSS custom properties to control animation parameters:
.marquee {
--duration: 20s;
--item-width: 200px;
animation: scroll var(--duration) linear infinite;
}
@media (max-width: 768px) {
.marquee {
--duration: 30s;
}
}
These modern approaches are part of the advanced CSS techniques we employ in our development projects. When working with DOM elements and selectors, understanding how to properly target and animate elements connects to our querySelector guide for efficient DOM manipulation.
Frequently Asked Questions
Performance Optimization
Creating performant marquee animations requires attention to several key factors.
Transform Over Layout Properties
Animating the transform property should always be preferred over animating properties like left, margin, or padding because transforms can be handled by the GPU through hardware acceleration:
/* Good - GPU accelerated */
.animated-item {
transform: translateX(-100%);
}
/* Bad - Triggers layout recalculation */
.animated-item {
left: -100%;
}
Content Optimization
For marquees displaying images, implement lazy loading and appropriate image sizes:
<div class="marquee">
<img src="logo1.png" loading="lazy" alt="Partner 1" width="120" height="60">
<img src="logo2.png" loading="lazy" alt="Partner 2" width="120" height="60">
<!-- More logos -->
</div>
Animation Timing
Choose appropriate animation durations based on content length and viewing context. Longer durations (20-30 seconds) work for logos and brief text, while shorter durations (3-5 seconds) may be needed for longer content that users need to read.
Performance optimization is a core part of our web development methodology, ensuring every animation contributes positively to user experience.
Accessibility Considerations
Respecting user motion preferences is essential for ethical marquee implementation.
Reduced Motion Support
The prefers-reduced-motion media query allows developers to detect when users have configured their operating system to minimize animations:
.marquee {
animation: scroll 20s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
.marquee {
animation: none;
white-space: normal;
}
}
Alternative Content
For users who cannot perceive or are distracted by scrolling animations, provide alternative access to marquee content:
- Include marquee content in a visually hidden element for screen readers
- Display content statically below or beside the marquee
- Provide an expandable section containing all marquee items
Cognitive Accessibility
Marquees present challenges for users with attention disorders or cognitive differences. Consider these guidelines:
- Use marquees sparingly and only for essential, brief information
- Avoid placing marquees near primary content areas
- Provide clear controls to pause or dismiss the animation
- Ensure scrolling speed allows adequate reading time
Accessibility is integrated into every project we deliver through our accessible web design practices.
Marquee Implementation Comparison
0
Browsers officially supporting <marquee>
60fps
FPS achievable with CSS transforms
100%
Percentage GPU composited
100%
Compliance with web standards
Conclusion
The <marquee> element's journey from useful innovation to deprecated legacy illustrates the web's evolution toward more performant, accessible, and standards-based development. While the element itself should never appear in new projects, the desire to create scrolling animations remains valid for many design contexts.
Modern CSS provides powerful alternatives that honor the marquee's original purpose while meeting contemporary expectations for user experience, accessibility, and technical excellence. By leveraging CSS animations, transforms, and emerging properties like offset with shape(), developers can create marquee effects that honor the past while embracing the future of web development.
Key Takeaways
- Never use the deprecated
<marquee>element in new projects - Use CSS
transform: translate()for hardware-accelerated animations - Implement
prefers-reduced-motionsupport for accessibility - Test across browsers, as advanced CSS features have varying support
- Consider whether scrolling animation genuinely adds value or creates distraction
Ready to modernize your website with cutting-edge web development practices? Our team specializes in building performant, accessible websites using the latest technologies and standards. Explore our web development services to learn how we can help transform your digital presence.
Sources
- MDN Web Docs - The Marquee element - Official documentation on the deprecated marquee element and its attributes
- Frontend Masters - Infinite Marquee Animation using Modern CSS - Advanced CSS techniques for marquee effects
- LogRocket - Deprecated HTML elements and what to use instead - Context on HTML deprecations and CSS animation alternatives