DEV Community

Discussion on: Explain HTML's img srcset vs picture tag Like I'm Five

Collapse
 
jessefulton profile image
Jesse Fulton

<picture> is useful if you want explicit control over how things are displayed, which is typically not necessary compared with srcset

But can't you do the same thing with each of them? I guess, I'm not seeing any functional difference between the two - they seem to only vary in the implementation. They both allow you to bias the browser into downloading an "optimized" version of an image based upon media queries, just in slightly different syntaxes. Does that sound correct?

Although, if one doesn't work on Safari (thanks for the tip!) that's reason enough for me to use one over the other (IE support is another issue though...)

Collapse
 
ben profile image
Ben Halpern

With srcset the browser does the math on retina displays and other scenarios where pixels for you might not be pixels for the user. With <picture> you'd have to do this all yourself.