A circular-style carousel built with HTML + Tailwind CSS, available in two implementations:
- CSS-only version (using
:has()and radio inputs) - JavaScript-enhanced version (dynamic, scalable, maintainable)
Show live demo here.
20260405_123439.mp4
- Pure CSS (no JavaScript)
- Uses
:has()andinput[type="radio"] - Smooth circular rotation
- Custom timing function
- Dynamic data-driven slides
- Centralized state management
- No duplicated HTML
- Scalable and maintainable
- Button controls with disabled states
This version uses:
input[type="radio"]for state:has()selector to control UI- CSS variables (
--current) to drive animations
- No JavaScript required
- Declarative approach
- Hard to scale
- Requires duplicated markup
- State logic tied to HTML
This version removes all CSS hacks and introduces:
- Data-driven rendering
- Centralized state (
current) - Dynamic DOM injection
Both versions rely on the same core idea:
transform: rotate(calc(var(--current) * 90deg));The difference is who controls
--current:
- CSS version →
:checked- JS version → JavaScript state
- Easier to maintain
- No duplicated HTML
- Easily extendable (autoplay, swipe, API data)
- Cleaner architecture (separation of concerns)
- Clone the repo:
git clone https://github.com/ArielLeyva/circular-carousel.git- Open in browser:
index.html → CSS version
index-with-js.html → JS version
MIT — feel free to use and modify.
Give it a star ⭐!