Pure CSS Image Slider with Thumbnails

Pure CSS Image Slider with Thumbnails

In this post, We will demonstrate another Responsive CSS Photo Slider but this time we will create it with thumbnails which work well with mobiles.

We do use a similar technique as we did for building a CSS content slider but the coded in a different way to achieve this. This slider have 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 and has four different examples. You can take a look at more examples here.

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.

How to Build a Image Slider with Thumbnails

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.

The Markup

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 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 why six? Yep, we have four images, but we also need to set the labels for 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, and we do this by using an again label with unique IDs. The ID names should be similar to radio button ID names which we defined above.

We will place each image thumbnail inside label to get it done.

<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.

Code ExamplesYou May Also Like