The images can be wider than the width of their container or smaller than it. To control the width of larger images, I can use max-width: 100%
. Similarly, I can also set width:100%
for smaller images.
Is there any way to set image width to 100% only if the original image is at least 50% of its container width? I will prefer a CSS based solution if it exists because the images will load dynamically.