picture (source) element VS img srcset attribute

Both srcset and picture do approximately the same thing, but there is a subtle difference:

  • picture dictates what image the browser should use, whereas
  • srcset gives the browser a choice. A lot of things can be used to select this choice like viewport size, users preferences, network condition and so on. Hopefully in the future browsers would become smarter and smarter with selecting the appropriate image.

The support for srcset is pretty good and almost all current browsers more or less support it. Situation with a picture element is a little bit worse.

Leave a Comment