- 101 CSS Sliders
- Table of Contents
- Related Articles
- Card Sliders
- Author
- Links
- Made with
- About the code
- Onboarding Screens
- Information Card Slider
- Elastic Slider
- Comparison (Before/After) Sliders
- Author
- Links
- Made with
- About the code
- Image Comparison Slider
- Author
- Links
- Made with
- About the code
- Javascriptless Before/After Slider
- Author
- Links
- Made with
- About the code
- Before After 3 Layer Image Slider
- Before After Image Slider (Vanilla JS)
- Author
- Links
- Made with
- About the code
- Split Screen UI
- Before & After Slider Gallery With SVG Masks
- HTML5 Before & After Comparison Slider
- Responsive Image Comparison Slider
- HTML5 Video Before-and-After Comparison Slider
- Image Comparison Slider
- Fullscreen Sliders
- Author
- Links
- Made with
- About a code
- Pure CSS ECommerce Slider
- Author
- Links
- Made with
- About the code
- Pure CSS Slider
- Author
- Links
- Made with
- About the code
- Slider Transition
- Author
- Links
- Made with
- About the code
- Horizontal Parallax Sliding Slider
- Author
- Links
- Made with
- About the code
- Smooth 3D Perspective Slider
- Fullscreen Hero Image Slider
- Velo.js Slider With Borders
- Popout Slider
- Responsive Parallax Drag-slider With Transparent Letters
- Fancy Slider
- Author
- Automatic Image Slider in HTML and CSS only
- Automatic Image Slider in HTML & CSS only without JavaScript
- Video preview of the Automatic Image Slider
- How to create Automatic Image Slider using HTML and CSS only?
- Step 1 – Write HTML code
- Copy HTML code
- Step 2 – Write CSS code and styling it.
- How do I make an Image Slider Autoplay?
- Copy CSS code
- Live preview of Automatic Image Slider in HTML & CSS only
- Conclusion
- Have you a project?
101 CSS Sliders
Collection of free HTML and CSS slider code examples: card, comparison, fullscreen, responsive, simple, etc. Update of May 2020 collection. 5 new items.
Table of Contents
Related Articles
Card Sliders
Author
Links
Made with
About the code
Onboarding Screens
A set of onboarding screens in HTML/CSS/JS. A personal experiment with layering PNG icons, CSS3 transitions, & flexbox.
Information Card Slider
HTML, CSS and JavaScript information card slider.
Made by Andy Tran
November 23, 2015
Elastic Slider
Photo slider working on desktop and mobile browsers.
Made by Taron
September 29, 2014
Comparison (Before/After) Sliders
Author
Links
Made with
About the code
Image Comparison Slider
A simple and clean image comparison slider, fully responsive and touch ready made with CSS and jQuery.
Author
Links
Made with
About the code
Javascriptless Before/After Slider
A before and after slider with only html and css.
Author
Links
Made with
About the code
Before After 3 Layer Image Slider
Playing around with a new idea using my two layer before/after image slider. Keeping it minimal. Keeping it vanilla. Like it if it’s useful 🙂
Before After Image Slider (Vanilla JS)
Vanilla JS, minimal, nice to look.
Made by Huw
July 3, 2017
Author
Links
Made with
About the code
Split Screen UI
A «split-screen» slider element with JavaScript.
Before & After Slider Gallery With SVG Masks
A little experiment for a before & after slider all inside a SVG. Masking makes it pretty simple. Since it’s all SVG, the images and captions scale nicely together. GreenSock’s Draggable and ThrowProps plugins were used for the slider control.
Made by Craig Roblewsky
April 17, 2017
HTML5 Before & After Comparison Slider
Uses customised range input for slider.
Made by Dudley Storey
October 14, 2016
Responsive Image Comparison Slider
Responsive image comparison slider with HTML, CSS and JavaScript.
Made by Ege Görgülü
August 3, 2016
HTML5 Video Before-and-After Comparison Slider
HTML5, CSS3 and JavaScript video before-and-after comparison slider.
Made by Dudley Storey
April 24, 2016
Image Comparison Slider
A handy draggable slider to quickly compare 2 images, powered by CSS3 and jQuery.
Made by CodyHouse
September 15, 2014
Fullscreen Sliders
Author
Links
Made with
About a code
Pure CSS ECommerce Slider
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Pure CSS Slider
Simple slider based on radio inputs. 100% pure HTML + CSS. Works also with arrow keys.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Slider Transition
Nice transition effect for fullscreen slider.
Author
Links
Made with
About the code
Horizontal Parallax Sliding Slider
Horizontal parallax sliding slider with Swiper.js.
Author
Links
Made with
About the code
Smooth 3D Perspective Slider
Responsive smooth 3D perspective slider on mouse move.
Fullscreen Hero Image Slider
Fullscreen hero image slider (swipe panels theme) with HTML, CSS and JavaScript.
Made by Tobias Bogliolo
June 25, 2017
Velo.js Slider With Borders
A slider interaction thing using Velocity and Velocity effects (UI Pack) to enhance the animation. Animation is triggered via arrow keys, nav click, or scrolling jack. This version includes borders as part of the interaction.
Made by Stephen Scaff
May 11, 2017
Popout Slider
Simple slider in a minimal style to show off images. Part of the image pops out on each slide.
Made by Nathan Taylor
Jannuary 22, 2017
Responsive Parallax Drag-slider With Transparent Letters
The thing is pretty easy customizable. You can safely change font, font size, font color, animation speed. The first letter of a new string in array in JS will appear on a new slide. Easy to create (or delete) a new slide: 1. Add new city in the array in JS. 2. Change number of slides variable and put a new image in scss list in CSS.
Made by Ruslan Pivovarov
October 8, 2016
Fancy Slider
- Clip-path for image masking rectangle border (webkit only).
- Blend-mode for this mask.
- Smart color system, just put your color name and value into sass map and then add proper class with this color name to elements and everything will work!
- Cool credits side-menu (click small button in the center of demo).
- Vanilla js with just
Author
Automatic Image Slider in HTML and CSS only
Automatic Image Slider in HTML & CSS only without JavaScript
Hello coders! Welcome to this blog.
We are talking about Automatic Image Slider, and today In this tutorial, we will learn How to make an Automatic Image Slider in HTML & CSS only. Yes! you heard it right, we will use only HTML & CSS to make this project.
Automatic Image Slider is common website UI, that you have must seen on many websites. On websites, you will generally see this in the Hero Section, Product Section, or Gallery Section. There are many images in the image slider, which it shows one by one to the User.
By the way, there are two types of sliders, one is a manual slider which has two buttons, the Next button, and the Previous button. And the second is the automatic slider which moves automatically at a fixed time interval. So we are going to make that, Automatic Image Slider using HTML and CSS only without JavaScript.
First of all, watch the preview video of this project.
Video preview of the Automatic Image Slider
How to create Automatic Image Slider using HTML and CSS only?
Here we have discussed How to create Automatic Image Slider in HTML CSS without JavaScript, step by step. Also, we have provided Automatic Image Slider source code!
Step 1 – Write HTML code
First, create an index.html file. Follow the instruction below.
In the HTML code, first, we have linked our stylesheet file in the tag. Then under the body tag we have created parent ,which class name is slider_container and under this parent slider_container we have created child which class name is slider .
- — It will be the whole slider container.
- – It will be our main slider, which will wrap all the slides and slide/move right to left automatically.
htmlDOCTYPE html> html lang="en"> head> meta charset="UTF-8"> meta http-equiv="X-UA-Compatible" content="IE=edge"> meta name="viewport" content="width=device-width, initial-scale=1.0"> title>Documenttitle> link rel="stylesheet" href="style.css"> head> body> section class="slider_container"> section class="slider"> section> section> body> html>
Then we created under the child section, we give a class name of the slide one, which will be our slide, and in this slide, we have for images content and tag with class name caption from slider caption.
If you have noticed that, we have created the class name of slide is slide one. Here slider is the common class and one is the unique class.
Because, we will keep this slider as multiple, then if we design a particular slider, then this class name will help us at the same time. Right now this is the first slider that’s why it has unique class one .
When we will add more slider then we will add two for second slider, three for third slider etc.
Note: in the image tag, you should not add these dots. Replace these dots with your image path or any other image link source.
htmlsection class="slider_container"> section class="slider"> div class="slide one"> img src=". " alt=""> span class="caption"> slide one span> div> section> section>
Here we have duplicated the slider 4 times, so we have created 5 sliders in the HTML code. Alright, now completed the HTML structure, now watch and copy the HTML code of Automatic Image Slider and paste it into your index.html file.
Copy HTML code
htmlDOCTYPE html> html lang="en"> head> meta charset="UTF-8"> meta http-equiv="X-UA-Compatible" content="IE=edge"> meta name="viewport" content="width=device-width, initial-scale=1.0"> title>Documenttitle> link rel="stylesheet" href="style.css"> head> body> section class="slider_container"> section class="slider"> div class="slide one"> img src=". IMAGE LINK. " alt=""> span class="caption"> slide one span> div> div class="slide two"> img src=". IMAGE LINK. " alt=""> span class="caption"> slide two span> div> div class="slide three"> img src=". IMAGE LINK. " alt=""> span class="caption"> slide three span> div> div class="slide four"> img src=". IMAGE LINK. " alt=""> span class="caption"> slide four span> div> div class="slide four"> img src=". IMAGE LINK. " alt=""> span class="caption"> slide five span> div> section> section> body> html>
Step 2 – Write CSS code and styling it.
After structuring the HTML code, then create a style.css file and follow the instruction below.
In the CSS code, we have styled the components and the elements. We have width, height, padding, margin, background, etc. We have used a flex-box layout container for proper alignment of the slider and all slides.
How do I make an Image Slider Autoplay?
As we know we are making Automatic Image Slider in HTML & CSS only, without JavaScript. So we should create that Autoplay slider animation using CSS.
So for that, as we discussed before, we created a in HTML with the class name slider, which will move right to left automatically with the help of CSS @keyframes animation.
So animating the slider, we have created a @keyframes animation whose name is sliding. Watch the below CSS code.
Copy CSS code
css* margin: 0; padding: 0; box-sizing: border-box; font-family: sans-serif; > body position: relative; width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; background: rgb(29, 29, 29); > .slider_container position: relative; width: 60%; height: 40rem; display: flex; justify-content: flex-start; align-items: center; overflow: hidden; > .slider position: relative; width: 400%; height: 100%; display: flex; flex-direction: row; align-items: center; justify-content: space-between; animation: 30s cubic-bezier(1, 0.95, 0.565, 1) sliding infinite; > .slide position: relative; min-width: 100%; height: 100%; > .slide img width: 100%; height: 100%; > .slide .caption position: absolute; left: 0; bottom: 5%; font-size: 5rem; font-weight: 600; color: white; text-transform: capitalize; background: rgba(0, 0, 0, 0.348); backdrop-filter: blur(10px); padding: 1rem 5rem; border-radius: 0 2rem 2rem 0 ; > .slide.one background: rgb(182, 19, 109); > .slide.two background: rgb(255, 64, 64); > .slide.three background: rgb(11, 173, 188); > .slide.four background: rgb(11, 188, 14); > .slide.five background: rgb(173, 11, 188); > @keyframes sliding 0% transform: translateX(0%); > 20% transform: translateX(0%); > 25% transform: translateX(-100%); > 45% transform: translateX(-100%); > 50% transform: translateX(-200%); > 70% transform: translateX(-200%); > 75% transform: translateX(-300%); > 95% transform: translateX(-300%); > 100% transform: translateX(-400%); > >
In this @keyframes animation, as you can see here, we have used CSS transform: translateX() . All the values in minus(-), because we will move them, from right to left.
Live preview of Automatic Image Slider in HTML & CSS only
Alright! We have Automatic Image Slider in HTML CSS CodePen live preview link here. CodePen Demo
Conclusion
This is all about Automatic Image Slider in HTML & CSS only. I hope you liked this project and enjoy it and learned something new. You can use it for your projects, also you can add it to your portfolio. If you have any queries related to this Project, let me know in the comments and contact me.
Have you a project?
Tell me more about it. I will help!