michaelmcgurk michaelmcgurk - 4 months ago 13
HTML Question

Make entire div area clickable hyperlink

How do I make the entire red area 'clickable'? I'd rather not use Javascript if I can help it.

https://jsfiddle.net/8m6z0h22/



.block {
width: 200px;
height: 272px;
background:red;
border: 0;
}

<div class="block">
<h3>Book a season ticket with Manchester United</h3>
<ul>
<li><a href="#" title="Read more about Manchester United">Read more about Manchester United <span class="bold">></span></a></li>
</ul>
</div>




Answer

Wrap all your code inside <a> tag instead of <div>.

.block {
    text-decoration: none;
    width: 200px;
    height: 272px;
    background:red;
    border: 0;
    display: block;
}
.block h3 {
  color: black;
}
.block ul li {
  text-decoration: underline;
}
<a href="#" title="Read more about Manchester United" class="block"> 
  <h3>Book a season ticket with Manchester United</h3>
  <ul> 
    <li>Read more about Manchester United <span class="bold">></span></li> 
  </ul>
</a>

Comments