Nested hyperlinked areas without nested link elements in HTML source

后端 未结 5 1972
被撕碎了的回忆
被撕碎了的回忆 2021-02-02 16:11

I\'d like to have something that looks and behaves as hyperlink inside larger rectangle (full page wide) which is also hyperlink. Below there is ASCII-art representation of what

5条回答
  •  情歌与酒
    2021-02-02 16:47

    What I have done in the past is use Javascript to attach the proper functionality to the div (assuming that is the parent element) so that when it is clicked, window.location is ran opening the .href attribute of the child link.

    Something like this perhaps.

    // jQuery Code
    $(".parentDivLink").click(function(){
      window.location = $(this).find("a.mainLink").attr("href");
    });
    
    
    

提交回复
热议问题