onClick , , SEO, .
You can only do this with HTML / CSS:
<style>
.background-div {
background-image:url("/path/to/image.jpg");
position:relative;
}
.href:after {
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
content:"";
}
</style>
<body>
<div class="background-div">
<a href="/a/url" class="href"></a>
</div>
</body>
In this case, relative positioning on the background-div will contain the link contained only for that div, and by adding a pseudo-element to the link, you have the freedom to still add text to the link (if necessary), expanding the radius of the click on the entire background div .
Lucas source
share