I'm trying to write a tag that lets me to control several aspects of an image like:
- Responsive image sizes
- Art direction
- Partially supported image formats like avif or webp
- Fall backs to common image formats like JPG & PNG
I'm a beginner and I'm still trying to work out way to do this, I know there are many resources around but I haven't been able to find one that covers these at the same time, and I'm not sure how to write it myself. I've tried:
<picture>
<source media="(orientation: landscape)"
srcset="land-small-test-image.avif 200w,
land-medium-test-image.avif 600w,
land-large-test-image.avif 1000w
land-small-test-image.jpg 200w,
land-medium-test-image.jpg 600w,
land-large-test-image.jpg 1000w"
sizes="(min-width: 700px) 500px,
(min-width: 600px) 400px, 100vw">
<source media="(orientation: portrait)"
srcset="port-small-test-image.avif 700w,
port-medium-test-image.avif 1200w,
port-large-test-image.avif 1600w
port-small-test-image.jpg 700w,
port-medium-test-image.jpg 1200w,
port-large-test-image.jpg 1600w"
sizes="(min-width: 768px) 700px,
(min-width: 1024px) 600px, 500px">
<img src="land-medium-test-image.jpg" alt="Car">
</picture>
The values above are just examples, I'd be very grateful if anyone could clarify for me how a tag that covers those aspects should look like when written down properly.