Make a div into a link

后端 未结 27 1627
栀梦
栀梦 2020-11-22 03:15

I have a

block with some fancy visual content that I don\'t want to change. I want to make it a clickable link.

I\'m looking for something l

相关标签:
27条回答
  • 2020-11-22 04:18

    why not? use <a href="bla"> <div></div> </a> works fine in HTML5

    0 讨论(0)
  • 2020-11-22 04:18

    You can make surround the element with a href tags or you can use jquery and use

    $('').click(function(e){
    e.preventDefault();
    //DO SOMETHING
    });
    
    0 讨论(0)
  • 2020-11-22 04:19

    if just everything could be this simple...

    #logo {background:url(../global_images/csg-4b15a4b83d966.png) no-repeat top left;background-position:0 -825px;float:left;height:48px;position:relative;width:112px}
    
    #logo a {padding-top:48px; display:block;}
    
    
    
    <div id="logo"><a href="../../index.html"></a></div>
    

    just think a little outside the box ;-)

    0 讨论(0)
提交回复
热议问题