can I use the img sizes attribute to define the intended height of image rather than the width?

Viewed 40

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?

0 Answers
Related