hh54188
hh54188

Reputation: 15626

HTML <picture> element doesn't work in Chrome 42

Here is my <picture> element on page:

<picture>
     <source media="(max-width: 6400px)" srcset="./images/large.jpg 1024w"  sizes="100vw" />
</picture>

But when I open my page in Chrome browser, I can't see any picture. Even no image is requested in devtools network panel.

I checked caniuse.com, that the Chrome 42 is support <picture> element.

So why the <picture> does't work?

Upvotes: 1

Views: 735

Answers (2)

tronman
tronman

Reputation: 10125

You are missing the <img> inside <picture>. Change your HTML to:

<picture>
   <source media="(max-width: 6400px)" 
           srcset="./images/large.jpg 1024w" sizes="100vw" />
   <img src="default.jpg" alt="my images" />
</picture>

Upvotes: 0

Jason
Jason

Reputation: 11363

According to caniuse, <picture> support is conditional on enabling experimental Web Platform features in chrome://flags

Upvotes: 1

Related Questions