I'm working on a wordpress customisation where I need an entire article tag to be a link.
Basically when I hover the <article> the background color changes (working) but I cannot figure the html to make that entire tag into a link.
I've tried both ways
<a href="mylink">
<article>
/*article content: an image, header &text*/
</article>
</a>
and
<article>
<a href="mylink">
/*article content: an image, header &text*/
</a>
</article>
The first code should work. add class to <a> tag and use css display:block property.
.block{
display: block;
}
<a class="block" href="mylink">
<article>
<img src="http://placehold.it/400/400" alt="" />
</article>
</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With