in , , ,

Turn a DIV into a Clickable Link


Recently, I was doing some modification on Techlomedia Gadgets, gadget research platform developed by me. I wanted to add few boxes with text on it. Clicking on box will open a link. This could only be done if I turn the whole DIV into a clickable link.

The DIV was something like this

This DIV also had some specified width and height. I wanted to make the whole DIV clickable. It means clicking anywhere in this DIV will open the URL mentioned in the hyperlink inside the DIV.

You can do it either by using CSS or jQuery. I am going to explain both ways.

CSS way:

In above way, we try hyperlink to occupy the whole DIV to make it clickable.

JQuey Way

Both ways will work without any issue. You can use as per your own choice. You should change the classes in CSS or jQuery code as per your own code.



Written by Deepanker

Deepanker Verma is the founder of Techlomedia. He is a tech blogger, developer and gadget freak.

Leave a Reply

Your email address will not be published. Required fields are marked *


Watch Instagram Stories anonymously

Share music on Instagram with Sounds app for Android

Flipkart API

How to Use Flipkart API to Fetch Products with PHP