Using srcset and sizes attributes allows browsers to download the most appropriate image size based on the device's characteristics.
<picture>
<source
media="(min-width: 1024px)"
srcset="large.jpg"
>
<source
media="(min-width: 768px)"
srcset="medium.jpg"
>
<img
ngSrc="small.jpg"
width="400"
height="300"
alt="Responsive image"
>
<picture>
Resize your browser window and check the Network tab. Different image sizes will be downloaded based on your viewport width. Here is more information about the best practices for responsive images: https://dev.to/activenode/srcset-sizes-picture-media-what-you-might-not-have-known-31nf
This image adapts its size based on the viewport width:
Card 1
Card 2
Card 3
Card 4