Pure CSS Image Slider with Thumbnails

You surely try out many of JavaScript thumbnails slider, right? But that’s overload your site and you want to create a lightweight version of the slider which is quite possible with CSS only. In this tutorial, we’ll demonstrate pure CSS responsive image slider with thumbnails. Also, this carousel comes with cross browser support .

We do use a similar technique as we did for building an Autoplay CSS Slideshow but the coded in a different way to achieve this. This slider has impressive features including Next/Pre and thumbnail clickable.

It is responsive and works well on all type of browsers and devices. It’s a beautiful slider which comes with nice and clean design. You can easily customize it as per your site design.

Furthermore, you can easily turn it into a CSS background image slider by just removing the container class. Its simple and easy slider for any kind of site.

Why CSS only carousel need attention? The answer is simple they are lightweight and easy to customize. It reduces the page load time and stays the way you from the JS errors or conflict.

You can quickly implement and play them as you want. It allows to change some images quickly and allow to add more or fewer images.

This slider is just like any JavaScript or jQuery slider and works in the same way. You can add your animation quickly if you know the advance command of CSS3. OK! let’s have a look at how it works.

How to Build an Image Slider with Thumbnails

If we look at the HTML, we will find it’s straightforward and easy to understand. All the slider HTML code hold inside a main div with class name “csslider“.

You also noted that it also has another class infinity and an ID “slider1" which will handle with CSS later on.

<div class="csslider infinity" id="slider1">
  ......
</div>

Next, we need to define the radio buttons, as similar other many Javascript sliders do. Each radio button has unique ID also an important thing to be noted is to an checked="checked"element is used for the first slider to set it as default slide.

<input type="radio" name="slides" checked="checked" id="slides_1"/>
<input type="radio" name="slides" id="slides_2"/>
<input type="radio" name="slides" id="slides_3"/>
<input type="radio" name="slides" id="slides_4"/>

Now you need to define the unordered list and place your image inside. The CSS support a total number of six images, so if you need to add more, you need to change the CSS.

<ul>
    <li><img src="https://cdn.pixabay.com/photo/2016/12/13/22/25/kingfisher-1905255_960_720.jpg"/></li>
    <li><img src="https://cdn.pixabay.com/photo/2016/11/26/23/45/dog-1861839_960_720.jpg"/></li>
    <li><img src="https://cdn.pixabay.com/photo/2016/12/14/12/09/violin-1906127_960_720.jpg"/></li>
    <li><img src="https://cdn.pixabay.com/photo/2016/11/29/20/22/child-1871104_960_720.jpg"/></li>
</ul>

Last but not least, we need to define the arrows by adding the label element. We will set six labels, but you may think about why six? Yep, we have four images, but we also need to set the labels to go to first and go to the last slider.

<div class="arrows">
    <label for="slides_1"></label>
    <label for="slides_2"></label>
    <label for="slides_3"></label>
    <label for="slides_4"></label>
    <label class="goto-first" for="slides_1"></label>
    <label class="goto-last" for="slides_4"></label>
</div>

In the end, we need to add the thumbnails, we’ll do this by using HTML label element with unique IDs. The ID names should be similar to radio button ID names which we defined above.

We will place thumbnails inside the label tag to get it working as pure CSS image slider.

<div class="navigation"> 
    <div>
      <label for="slides_1"><img width="75" height="75" src="https://cdn.pixabay.com/photo/2016/12/13/22/25/kingfisher-1905255_960_720.jpg"/></label>
      <label for="slides_2"><img width="75" height="75" src="https://cdn.pixabay.com/photo/2016/11/26/23/45/dog-1861839_960_720.jpg"/></label>
      <label for="slides_3"><img width="75" height="75" src="https://cdn.pixabay.com/photo/2016/12/14/12/09/violin-1906127_960_720.jpg"/></label>
      <label for="slides_4"><img width="75" height="75" src="https://cdn.pixabay.com/photo/2016/11/29/20/22/child-1871104_960_720.jpg"/></label>
    </div>
</div>

We are done now with the slider and let’s have a look the CSS and see the demo above and download the source code.

Hope you like it and find useful. Leave the comment and share with your friends.

You Might Be Interested In:

Ashfaq Ahmed is a freelance WordPress developer and owner of codeconvey.com. I developed modern and highly interactive websites. I always focus on improving my development and design skills.

1 thought on “Pure CSS Image Slider with Thumbnails”

  1. Thank you! I had been looking everywhere for a non Javascript slider. It’s what CSS is suppose to solve!

Comments are closed.