frontend.fyi

Creating a Carousel Without JavaScript — Rebuilding a Carousel From Apple's Website

🧑‍💻 🎥
... Almost ready!

What you’ll learn

In this video, I demonstrate how to build a carousel using only CSS and HTML. Using CSS Scroll Snap, we can create scrollable divs that act like a carousel without the need for JavaScript. I’ll show you how to build the carousel, and explain why this method might be a better alternative to using a JS library.

However, it’s worth noting that not using a carousel at all is probably an even better solution. We do use a little bit of JavaScript in the end to make the previous and next buttons work.