Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want an image to change depending the size of the screen.
i use this code and it works fine.

<pre>
<picture>
<source srcset="map-small.jpg" media="(max-width: 750px)">
<source srcset="map.jpg">
<img src="map.jpg" alt="map" style="width:auto;">
</picture>	



but when i add a hyperlink it doesn't.

<picture>
<source srcset="map-small.jpg" media="(max-width: 750px)">
<source srcset="map.jpg">
<a href="index.html" ><img src="map.jpg" alt="map" style="width:auto;"></a>
</picture>	


Is there a way to fix it?
Thanks in advance.

What I have tried:

<picture>
<source srcset="map-small.jpg" media="(max-width: 750px)">
<source srcset="map.jpg">
<a href="index.html" ><img src="map.jpg" alt="map" style="width:auto;"></a>
</picture>	
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900