1

How do I make my entire pad div area a hyperlink?

http://jsfiddle.net/obxh7qpn/

Here's my 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>
Jeremy W
  • 1,889
  • 6
  • 29
  • 37
michaelmcgurk
  • 6,367
  • 23
  • 94
  • 190

2 Answers2

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>

wrap a tag around the whole thing!

taesu
  • 4,482
  • 4
  • 23
  • 41
2

Use "onclick=" event instead of href

<div onclick="document.location='http://www.google.com'> ...
Damien
  • 119
  • 1
  • 9