Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an entire bootstrap thumbnail clickable (for mobile and tablet)

Using Bootstrap3, I am trying to make a page with few thumbnails leading to different links. I have figured out how to make hover effect with text and link but now I am confused how it can be used with mobile and tablet as there is no hover for those.

I am wondering how to make the entire thumbnail clickable? and is it a good idea to make it so?

Here is a bootply link for you to see what I mean http://www.bootply.com/OuUBXv4ope

like image 979
saicode Avatar asked Jun 18 '14 02:06

saicode


People also ask

How do I make an entire image clickable in HTML?

How To Create A Clickable Image In HTML? The <img> and the <a> tags together is the most common way of adding a clickable image link in HTML. In a webpage, after adding an image using the <img> tag, make it clickable by adding a <a> tag along with it.

What is the use of thumbnail to bootstrap?

Bootstrap helps web developers to create thumbnails that are used to show linked images in grids with the pre-defined classes which help to reduce codes length. Thumbnails are created to provide a quick preview of images with small images. Thumbnail Image: A thumbnail is a small image that represents a larger image.


1 Answers

Making the entire thumbnail clickable is a good idea in terms of user accessibility and in fact, easy to make.

According to your code:

<div class="col-sm-4">
    <div class="thumbnail">
        <!-- Place the anchor tag here to cover both your caption and image -->
        <a href="#" class="">
            <div class="caption">
                <h4 class="">Thumbnail Headline</h4>
                <p class="">Lorem ipsum dolor
                </p>
            </div>
            <img src="http://lorempixel.com/400/300/technics/1/" alt="..." class="">
        </a>
        <!-- Anchor tag ends covering both image and caption -->
    </div>
</div>

DEMO (The first 3 thumbnails)

like image 62
AyB Avatar answered Sep 28 '22 15:09

AyB