2 ms·
Would someone mind explaining what "semantics" a "picture" has that an "image" doesn't have (I'm not too familiar with semantic HTML)? It seems kind of bizarre
by mehrdadn 7y ago
Would someone mind explaining what "semantics" a "picture" has that an "image" doesn't have (I'm not too familiar with semantic HTML)? It seems kind of bizarre that the img tag couldn't do both jobs.
- southerntofu 7y agoAn <img> is a tag that finds space to fit an actual grid of pixels. A <picture> is a responsive-aware tag that can several <source> of actual images (of different sizes), as well as an actual <img> for legacy browsers to still be able to render something. The <picture> element was standardized with HTML5 so the browser can figure out what <source> is best for its resolution, network speed/cost... This way mobile phones don't have to download fancy 4K backgrounds, and we don't have to use Javascript because it's part of the HTML spec.