<picture>
<source type="image/webp" srcset="images/me.webp">
<img id="avatar" src="images/me.webp" alt="Me">
</picture>
When I use the picture
element, the browser(chrome) doesn't load the image with the other resources. However, when I replace <picture>
with only <img>
element it works fine:
<img id="avatar" src="images/me.webp" alt="Me">
Why is that happening?
Your code will load the me.webp image if the browser supports its. If not, the jpg image will be shown (which works). Chrome 67 supports webp format, so the only issue I can figure out is that me.webp is not in the images folder.