如何将整个pad
div区域变为超链接?
这是我的HTML:
<div class="pad">
<div href="http://www.google.com" style="height:286px;width:286px;background:url('http://placehold.it/1x1') top center no-repeat;background-size:cover">
<div>
<span>View all</span>
</div>
</div>
</div>
答案 0 :(得分:3)
<a href='http://www.google.com'>
<div class="pad">
<div style="height:286px;width:286px;background:url('http://placehold.it/1x1') top center no-repeat;background-size:cover">
<div>
<span>View all</span>
</div>
</div>
</div>
</a>
围绕整个事物包装标签!
答案 1 :(得分:2)
使用&#34; onclick =&#34;事件而不是href
<div onclick="document.location='http://www.google.com'> ...