I am trying to work with srcset in a combination of container-fluid from Bootstrap.
I know, there is something wrong but I cannot figure out what it is! I am trying to use calc because I don't have the exact number for image width.
In @media (max-width : 991.98px) media query all the images has the same width. And above that, I have one big image at the top with two smaller one below it.
Also, I am using lazysizes to help me calculate the size. Do I really need to use this?
I appreciate if anyone can help me out here.
https://codepen.io/Sasanmore/pen/zJrEpB
<figure class="p-2 largefig col-xl-12 col-lg-12">
<img data-sizes="auto"
alt="test"
data-src="https://via.placeholder.com/2880x1920"
data-srcset="https://via.placeholder.com/600x400 600w,
https://via.placeholder.com/1200x800 1200w,
https://via.placeholder.com/1800x1200 1800w,
https://via.placeholder.com/2880x1920 2880w"
sizes="(min-width: 1200px) 100vw"
class="img-fluid lazyload">
</figure>
<figure class="p-2 col-lg-6 smallfig col-xl-6">
<img data-sizes="auto"
alt="test"
data-src="https://via.placeholder.com/2880x1920"
data-srcset="https://via.placeholder.com/600x400 600w,
https://via.placeholder.com/1200x800 1200w,
https://via.placeholder.com/1800x1200 1800w,
https://via.placeholder.com/2880x1920 2880w"
sizes="(min-width: 1200px) calc(0.5 * (50vw - 1em)),
(max-width: 991.98px) calc(1 * (100vw - 1em)), 100vw"
class="img-fluid lazyload">
</figure>