Fallback of <picture> element not triggering

Viewed 56

I'm trying to make a picture element work but it doesn't load the fallback img

   <div class="card">
        <picture>
            <source type="image/png" srcset="https://company-dev.s3.amazonaws.com/carscan/https://lorempixel.com/250/250/transport/?66555">
            <img class="card-img-top scale-on-hover" alt="Fallback" src="http://carscan.test/storage/images/no_image_found.jpg">
        </picture>

        <div class="card-body">
            <h6><strong>Location</strong>: Door LB</h6>
            <p><strong>Type</strong>: Window Crack <br>
            <strong>Severity damage</strong>: Medium</p>
        </div>
    </div>

In my browser I get a 403 on the source (aws) element, but then I expect it to go to the fallback image. But instead it shows me the little img icon together with my alt text

When I remove the source item out of the element my img element is shown without any problems. Am i forgetting an element or a small character?

1 Answers

Try this as an alternative

 <p>
    <object data="https://company-dev.s3.amazonaws.com/carscan/https://lorempixel.com/250/250/transport/?66555" type="image/png">
       <img src="https://cdn.sstatic.net/Img/unified/sprites.svg?v=e5e58ae7df45" alt="Stack Overflow logo and icons and such">
    </object>
 </p>

Related