Advertisement

Seamless Infinite Logo Carousel in Pure CSS

| by Vladimir | 2 min read | code by Jack Oliver
Beginner

Tech & Dependencies

HTML SCSS

Features

  • Infinite Loop
  • CSS Marquee
  • Gradient Masks

Browser Support

Chrome 43+ Edge 12+ Firefox 16+ Safari 9+

Core

This is a Seamless Infinite CSS Logo Carousel. It creates an automatic, never-ending horizontal scrolling effect for a set of images, typically used for partner or client logos. Its function is to provide continuous visual social proof without requiring user interaction or heavy JavaScript logic.

Specs

  • Weight: < 1 KB. Pure CSS and HTML.
  • Performance: High. Relies on GPU-accelerated transform: translateX for movement, avoiding layout recalculations during the scroll.
  • Theming / Customization: Managed via SCSS variables (e.g., $animationSpeed) and explicit width calculations.
  • Responsiveness: Fixed width (960px) in this snippet, requiring structural adjustments (like max-width: 100%) for mobile viewports.
  • Graceful Degradation: If CSS animations fail, it defaults to a static, overflow-hidden horizontal row of images. [!] Lacks a prefers-reduced-motion media query to pause the animation for users with vestibular disorders. Duplicated images also lack aria-hidden="true", causing screen readers to announce them twice.

Anatomy

  • HTML: A .slider container clipping a wide .slide-track. The track contains 14 .slide items (7 unique images, duplicated exactly once).
  • CSS (SCSS): Uses flex to align items horizontally. The .slider pseudo-elements (::before, ::after) generate transparent-to-white linear gradients to softly mask the edges.

Logic

The illusion of an infinite loop relies entirely on math and element duplication.

@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(-250px * 7))}
}

The track is moved to the left by exactly the total width of the original 7 items (-250px * 7). Because the 8th item in the DOM is an exact visual replica of the 1st item, the moment the animation reaches 100%, it snaps back to 0% imperceptibly. This single frame reset creates a flawless, perpetual scroll.

Feel

Smooth and unobtrusive. The linear easing ensures a constant, predictable pace. The white gradient masks soften the entrance and exit of the logos, making the component feel deeply integrated into the page’s background rather than a harsh, constrained scrolling box.

Advertisement