Every carousel has its own style, so there is no best method for building one. But I’ve collected 10 of the best open source snippets from CodePen that you can use as templates for your own carousels.
These designs range in style and behavior, but they all run on pure CSS code.
Netflix Show Carousel
This Netflix carousel is pretty unique with a hover-to-zoom animation effect for each video. The links in the carousel don’t go anywhere but you could easily embed these to work with videos.
Since this version only uses CSS it’s tougher to include dynamic effects like video modal windows. But you can still use this to create a slider that functions well in all browsers with a Netflix-style hover animation.
Annotated Linear Carousel
Some carousels use annotations to add subtitles and extra context over each slide. You can replicate this effect by cloning this pen written in pure HTML/CSS code.
There are no arrows or dot navigation elements, so the entire thing is click/touch controlled. Just click to the right or left of the carousel and you’ll immediately advance to that side. This rotates infinitely, so you’ll never hit the end either way.
Each transition has a small fading effect which is also controlled through CSS. It’s all very impressive and works great as a simple UI template.
Here’s a slightly cleaner fading carousel UI that does include the small dot navigation along with arrows on either side. This is fully controlled through CSS where the arrows work like radio buttons.
Each HTML radio input connects to a different image so you can click to browse through them with ease. The fading effects also run through CSS with mixins from this Sass library for carousels.
Here’s another radio button slider controlled by CSS and some added captions. But this pen created by Vo Tuan Trung is also fully responsive and should work in any modern browser.
All of the CSS is written in Sass and it uses the Bourbon mixins library for extra features. The sliding animations pan left or right depending on which direction the content is moving. This is a cool effect and surprisingly detailed for only running on CSS code.
CSS3 Testimonials Slider
These elements follow a modern and simplistic approach to design. Not too much color, texture, or extra design pizzazz.
If you want something a little more detailed check out this related pen by developer Sara Soueidan. It’s a little more compact but also has more flair to the design.
You can do a lot with CSS transitions and keyframe animations. And this picture frame animation shows how much you can do with just a simple slider.
Each photo moves to either side with a simple sliding animation effect. You can add photos inside regardless of size because even the frame is made with pure CSS. Pretty cool right?
For a darker example you might like this CSS slider built on top of a dark background. It uses bright green highlights to grab attention and strong caption animations.
This slider is incredibly simple to use, plus the animations are top notch. The fact that it runs on just CSS3 is quite impressive. We really do live in the golden age of web design!
CSS Image Carousel
With this image carousel there’s a lot you can change with just a few lines of code. The design is incredibly simple and it uses CSS to create a small frame around the photos.
This is one of the few carousels that doesn’t bother with animations, so the transitions are rough and direct.
But it all works with less than 100 lines of CSS, and there’s no Sass code, so it’s easy to copy/paste this into any layout.
Pure CSS3 Carousel
If you want a clean starting point for a fixed-size image slider then check out this design by Hélio Marcondes.
Each background rotates with the text in a very simple animation. Again this is pretty short with only ~80 lines of CSS and a few dozen lines of HTML.
I would say this is one of the barest templates you’ll find for creating a pure CSS carousel. It’s certainly not perfect but it offers a great starting point.
Text carousels can work great for testimonials or various quotes on a homepage. And if you want to avoid messy JS code you can use this rotating text carousel built with pure CSS.
Each block of text has its own animation cycle which follows a pattern across five different quotes. You could increase or decrease the number by adding/removing CSS classes which makes it all the better for easy editing.
And if you’re looking for a text-only carousel with a bit more flair check out this example by Matthew Hirsch.
These are some of the best examples I could find online, but I know there are many others. If you’re curious to find more take a look over the carousel tag on CodePen.
- 15 Free Slider & Carousel jQuery Plugins
- How CSS Variables Can Improve Efficiency and Consistency
- 10 Free Responsive Pricing Table HTML & CSS Snippets
- 8 Creative CSS & JS Snippets for Creating Pixelated Backgrounds