2

My image should always be rendered with a specific height of 500px

<picture>
  <source
    srcset="
      small-image.webp 500h,
      bigger-image.webp 1000h,
      huge-image.webp 2000h
    "
    media="all"
    type="image/webp"
    sizes="500px"
  >
  <img src="fallback-image.webp" alt="An image with a height of 500px">
</picture>

But the sizes spacification states:

The <source-size-value> gives the intended layout width of the image. The author can specify different widths for different environments with <media-condition>s.

So sizes can only specify widths?

loominade
  • 1,028
  • 1
  • 11
  • 21
  • Related: [HTMLImageElement.sizes](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes) – Sercan Jan 12 '22 at 09:20

0 Answers0