Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make an image clickable?

Here is the html:

<div id="panelpic1">
    <a href="https://www.google.com/"style="display:block"target="_blank">
    </a>
</div>

CSS:

  #panelpic1{
            content: url(file:///D:/MOHIT/HTML/images.jpg);
            float: left;
            width: 250px;
            height: 150px;
            vertical-align: middle;               
           }

This is the way I did it, but it is not working. The image is not clickable. What to do?

like image 625
jack reacher Avatar asked Feb 05 '17 11:02

jack reacher


People also ask

Can an image be clickable?

To create a clickable image online, all you need is a JPG file and a website address (the URL). Just as you can add a link to any text on a web page or Word document, you can add a link to any image file, including JPGs, PNGs and GIFs.

How do I make a clickable image button?

We can create a clickable HTML button using the <button> tag in HTML. Placing the <img> tag inside the <button> tag creates a clickable HTML button with an image embedded in it.


1 Answers

<!DOCTYPE html>
<html>
<body>

<span>Open image link in a new tab: 
 <a href="http://www.google.com" target="_blank">
  <img src="D:/MOHIT/HTML/images.jpg" />
 </a>
</span>

</body>
</html>

This is not the best approach. Here is one of the standard approaches to make image clickable.

<a href="your landing page url">
 <img src="your image url" />
</a>

Now, this image will redirect to you on specified URL on click.

There are many ways to do it from uploading it S3/dropbox to using FSCollection (that's for node users only).

So in your case, your snippet will look like this,

<a href="http://www.google.com">
 <img src="D:/MOHIT/HTML/images.jpg" />
</a>
like image 178
Mukul Jain Avatar answered Oct 04 '22 07:10

Mukul Jain