I have the same image at multiple widths, e.g. balloon-35.webp
, balloon-40.webp
, balloon-90.webp
.
I also have multiple img
elements with different widths, e.g. <img width="35"/>
, <img width="40"/>
, <img width="90"/>
.
Can I specify the srcset
attribute for each img
with the 3 files mentionned above and have the img
element chose the right file according to the width
attribute? For example, if the width of the img
is 35, then the 35 file is chosen.
Or is my only option to change the src
attribute with the right file depending on the width? Or is there another way to achieve what I want?
Cheers!