srcsetBy adding the srcset attribute to your img elements, you can indicate to the browser that an image is available in other resolutions.
I've saved the same image three times: one with a width of 500 pixels, one with a width of 1000 pixels, and the last one at 2000 pixels wide.
displayed at 500 pixels wide or less (max-width: 500px).
<img src="etc/images/stainedglass-250.jpg" srcset="etc/images/stainedglass-500.jpg 500w, etc/images/stainedglass-1000.jpg 1000w, etc/images/stainedglass-2000.jpg 2000w">
You write srcset with the structure "filename-1 image-width, filename-2 image-width, etc." and the browser does the rest!
The browser will choose the image which has the best resolution for the size displayed and the screen's ppi (pixels per inch).
This is useful because:
srcset, the image loads normally.And so everybody's happy! (mostly)
For more info, check out css-tricks!