Zest.

HTML: Responsive image

A short, tested HTML example for responsive image. Copy it and adjust the names and paths for your project.

HTML
<picture>
  <source type="image/avif" srcset="photo-480.avif 480w, photo-960.avif 960w" sizes="(max-width: 600px) 100vw, 600px">
  <img src="photo-960.jpg" width="960" height="640" alt="Description" loading="lazy">
</picture>

Find it in Zest

Search for “html responsive image” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More HTML examples

All HTML examples