CSS Infinite Marquee
A seamless, endlessly scrolling row with faded edges. Great for logo strips.
HTMLCSSDesignMotion
HTML
<div class="marquee">
<div class="marquee-track">
<span>HTML</span><span>CSS</span><span>Design</span><span>Motion</span>
<span aria-hidden="true">HTML</span><span aria-hidden="true">CSS</span><span aria-hidden="true">Design</span><span aria-hidden="true">Motion</span>
</div>
</div>
CSS
/* The track holds the items twice so the loop is seamless */
.marquee {
width: 260px;
overflow: hidden;
-webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}
.marquee-track {
display: flex;
gap: 12px;
width: max-content;
animation: marquee-scroll 10s linear infinite;
}
.marquee-track span {
padding: 8px 16px;
border-radius: 999px;
background: #111;
color: #fff;
font: 600 14px system-ui, sans-serif;
}
.marquee:hover .marquee-track {
animation-play-state: paused;
}
@keyframes marquee-scroll {
to { transform: translateX(calc(-50% - 6px)); }
}
@media (prefers-reduced-motion: reduce) {
.marquee-track {
animation: none;
}
}
About this CSS Infinite Marquee
This CSS Infinite Marquee is 36 lines of pure CSS (0.8 KB) with no JavaScript and no dependencies. It uses keyframe animations, transforms, linear gradients and masks. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
The colors in this snippet. Search and replace them to match your brand:
#000#111#fff
How to use this infinite marquee
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.marqueeclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.