Making the entire div clickable

We could make an entire div tag clickable by redirecting the click to a page and by changing the cursor sytle to a pointer. This is good if you want your logo or your banner to be clickable, specially if the logo is embedded together with the banner. Making the entire banner clickable would be very beneficial to your site.

<div onclick=”location.href=’http://www.tildemark.com/’;” style=”cursor: pointer;”>
</div>
22 Comments
  1. this was extremely useful for me, thank you very much =)

  2. Thank you! helped me a lot!

  3. great tip, thanks!

  4. Really Good….Thx buddyy…its working

  5. very good code !
    thanks a lot

  6. sir… naa kay solo picture ni maam tin2x?…

  7. sir … naa kay solo picture ni maam tin2x?

  8. you can find pictures of her on facebook. who are you by the way?

  9. Me ha venido muy bien …Thank you Tildemark

  10. This worked for me, but I had to do some playing around.. here’s the code I used:

    Thanks!

  11. {div onclick=”location.href=’http://www.YourUrlHere.com/’;” style=”cursor: pointer;”} {div id=”logo”}
    {/div}{/div} –> replace brackets with >

  12. Thanks! Just what we needed!!

  13. Unfortunately, this link wont be picked up for seo purposes.

  14. it also doesnt change the status bar onmouseover – the user cant tell where they will be directed to.

  15. Thanks, easy solution :)

  16. To make the link open in a new browser window:
    {div onclick=”window.open(‘http://www.mysite.com’,'_blank’);” style=”cursor:pointer;”}
    {/div}
    * replace braces “{ }” with “”

  17. I cannot use this code! It doesnt work for me!!! Can you please send me instructions on my mail pitlord89[at]hotmail.com
    I have this code:
    {div id=”home”}{/div}
    {div id=”hosting”}{/div}
    {div id=”support”}{/div}
    {div id=”contactus”}{/div}
    {div id=”ordernow”}{/div}
    And when i add you code it becomes>
    {div id=”home”}{div onclick=”location.href=’http://www.tildemark.com/’;” style=”cursor: pointer;”}
    {/div}
    And its not working! Please help!!!

  18. @Butcher
    You’ll need to add the code to the div itself. Use it like this:
    {div id=”home” onclick=”location.href=’http://www.tildemark.com/’;” style=”cursor: pointer;”}
    {/div}
    It all needs to be 1 div rather than the opening {div id=”home”} then {linking div}

  19. It has worked for me. I used it to link the entire div to my facebook page.. Thanks

  20. Thanks for this. I spent a ton of time trying to get the logo image for my blog to be clickable. This made it easy.

  21. Works for me but i had to have a link in an {a href} tag still because my hover over no longer worked for some reason :/

  22. Sweet!! Perfect for making buttons with css background and html text. Thanks!

Leave a Reply