HTML - how to make an entire DIV a hyperlink? [dup

2019-02-01 15:39发布

This question already has an answer here:

How do I make an entire DIV a clickable hyperlink. Meaning, I essentially want to do:

<div class="myclass" href="example.com">
    <div>...</div>
    <table><tr>..</tr></table>
    ....
</div>

And whenever someone mouse hovers of the myclass DIV, I want the entire DIV it to be a clickable hyperlink.

7条回答
劳资没心,怎么记你
2楼-- · 2019-02-01 16:27

alternative would be javascript and forwarding via the onclick event

<div onclick="window.location.href='somewhere...';">...</div>
查看更多
登录 后发表回答