-
-
Couldn't load subscription status.
- Fork 19
Open
Description
Currently we dont set a sizes attribute. But if there is no sizes attribute, the browser has no chance to know how big the image will, so it used the viewport sizes to decide which image scale to load.
This works for desktop vs mobile, but it fails when we have a small image on a big screen, like in listings or teaser.
We should always set sizes, as a fall back we can set the following:
For a picture variant, which does not define sizes, use the default scale.
For example:
"small": {
"title": "Small",
"sourceset": [
"scale": "preview",
"additionalScales": ["large", "larger"],
],
},preview scale is 400px:
<picture>
<source
srcset="https://placehold.co/400 400w,
https://placehold.co/800 800w,
https://placehold.co/1000 1000w,
sizes="(min-width: 576px) 400px, 98vw"
/>
<img
alt=""
width="400"
height="300"
src="https://placehold.co/400"
/>
</picture>when sizes string is given, we use that.
The later parameter has to added.
Metadata
Metadata
Assignees
Labels
No labels