Responsive images that do not blow the bandwidth budget

Html

srcset lets the browser pick; sizes tells it how wide the image will actually be rendered.

<img
  src="photo-800.jpg"
  srcset="photo-400.jpg 400w, photo-800.jpg 800w, photo-1600.jpg 1600w"
  sizes="(max-width: 700px) 100vw, 700px"
  width="800" height="600"
  loading="lazy" decoding="async"
  alt="A harbour at low tide" />

More in Web & CSS

Random picks