How to Build Responsive Images with srcset
Yes I know, we’ve already covered things about responsive images. The thing with tutorials is that everyone teaches in a different manner, and everyone learns differently as well. This may be the one that will click for you and get you adding RWD images to your site today.
There are a number of ways to enable responsive behavior of images. One of the older methods (not recommended) is by simple scripting, but this leads to a couple of problems. One, if a script determines which image to download, but the script itself is loaded after the images specified in the HTML have been downloaded, you may potentially end up with two downloaded images. Two, if you don’t specify any image in HTML and want to load only the image as defined by the script, you’ll end up with no image at all for the browsers which have scripting disabled.
An excerpt from How to Build Responsive Images with srcset