Archived topic
image with link
3 replies · Started by Den on January 5, 2022
Viewing posts 1–4 of 4
Hello team,
I am serving different images for mobile and desktop screens. But I don't know how to add a link to those images. For example, I want to insert my amazon affiliate link but I don't know how to do it.
The affiliate link will be same for both images.
The code I'm using:
<picture>
<source
media="(min-width: 650px)"
srcset="images/img1.png">
<source
media="(min-width: 465px)"
srcset="images/img2.png">
<img src="images/img-default.png"
alt="a cute kitten">
</picture>
Can you please help me out with this.
Hi there,
you can wrap your picture element in an anchor link eg.
<a href="your_link_goes_here">
<picture>
<source
media="(min-width: 650px)"
srcset="images/img1.png">
<source
media="(min-width: 465px)"
srcset="images/img2.png">
<img src="images/img-default.png"
alt="a cute kitten">
</picture>
</a>
Thanks David.
Could you raise a separate topic for that question.
This archived topic is closed to new replies.