Turn a DIV into a Clickable Link

Best WordPress Hosting

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.

advertisement

About The Author

  • ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!