DEV Community

Discussion on: 10 HTML Elements You Didn't Know You Needed

Collapse
 
capsule profile image
Thibaut Allender

I would avoid using the picture element in 2019. It's mostly a remanent from the first responsive images implementation. img now also has access to easier srcset and sizes attributes and has a smaller footprint. See ericportis.com/posts/2014/srcset-s... , especially part 2.

Collapse
 
fluffy profile image
fluffy

Yeah, came here to say the same thing – img srcset is supported everywhere, already gives you correct fallback "for free" (since you still declare a src attribute for that purpose), and provides all of the CSS query selector stuff in a much more compact, easily-parsed and easily-generated format. For example, the article's code would be captured as <img src="img_kitten.jpg" alt="Kitten" srcset="img_cat_fat.jpg 650w, img_cat_fluffy.jpg 465w">