DEV Community

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

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">