Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make entire <article>-tag a link

Tags:

html

wordpress

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>
like image 693
suMi Avatar asked Oct 20 '25 23:10

suMi


1 Answers

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>
like image 77
Kijan Maharjan Avatar answered Oct 23 '25 14:10

Kijan Maharjan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!