DEV Community

loading...

Discussion on: Safari's implementation of srcset is buggy, rendering the whole feature basically useless

Collapse
thrnd profile image
Daniil Kiyanov • Edited

2020... safari still has bugs with srcset/sizes...

Just use a couple of sources instead of srcset / sizes like that:

<picture>
    <source srcset="img--s--lg.webp" media="(min-width: 1281px)" type="image/webp" />
    <source srcset="img--s--sm.webp" media="(max-width: 1280px)" type="image/webp" />
    <source srcset="img--s--lg.png" media="(min-width: 1281px)" type="image/png" />
    <source srcset="img--s--sm.png" media="(max-width: 1280px)" type="image/png" />
    <img src="img--s--lg.png" alt="alt text" />
</picture>
Enter fullscreen mode Exit fullscreen mode

Just helped me with this problem.