This CSS-only carousel is a cutting-edge UI component that achieves high-end interactivity without JavaScript by using the experimental CSS Scroll Snap 2 and Anchor Positioning APIs.
Core Architecture
Zero-JS Logic: It utilizes ::scroll-marker and ::scroll-button pseudo-elements to automatically generate functional navigation dots and "Next/Prev" arrows.
::scroll-marker
::scroll-button
Precision Snapping: The scroll-snap-type: x mandatory property ensures slides lock perfectly into the center, while scroll-initial-target (via the scroll-start class) defines the default active slide on page load.
scroll-snap-type: x mandatory
scroll-initial-target
scroll-start
Responsive Scaling: The container uses width: min(calc(100% - 2rem), 700px), allowing it to be responsive while capping its maximum size.
width: min(calc(100% - 2rem), 700px)
Visual Design & UX
State-Aware Effects: Using @container scroll-state(snapped: inline), the carousel detects the "active" slide. Inactive slides are automatically scaled to 0.5 and faded, creating a cinematic focal point on the center item.
@container scroll-state(snapped: inline)
BSD-3 license (https://opensource.org/licenses/BSD-3-Clause)