Reputation: 1894
<img src="media/640x320_image.jpg" srcset="media/640x320_image.jpg 320w, media/640x1280_image.jpg 768w" sizes="(min-width:768px) 768px, 320px">
What is wrong with the srcset and sizes above? The 640x1280_image.jpg always shows, when I make my window small it doesn't change.
Upvotes: 1
Views: 295
Reputation: 2031
I don't understand media/640x1280_image.jpg 768w
. Do you really use a 640px wide image, but tell the browser it is 768px wide?
It breaks everything in the srcset
algorithm, for sure.
It looks like you want to use Art Direction to have images of different proportions based on the viewport width.
If this is what you want, you need to use <picture>
, because srcset
alone doesn't provide this.
Upvotes: 1